Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class PlaceBlocks : MonoBehaviour {
- [SerializeField]
- protected GameObject block;
- [SerializeField]
- protected float separation = 20f;
- [SerializeField]
- protected float reduction = 1f;
- [SerializeField]
- protected float blockHeight = 2f;
- [SerializeField]
- protected int blockCount = 10;
- void Start () {
- float currentSeparation = separation;
- for(int x = 0; x < blockCount; x++)
- {
- GameObject obj1 = GameObject.Instantiate(block);
- GameObject obj2 = GameObject.Instantiate(block);
- obj1.transform.position = new Vector3(-currentSeparation, blockHeight * x, 0);
- obj2.transform.position = new Vector3(currentSeparation, blockHeight * x, 0);
- currentSeparation -= reduction;
- }
- }
- }
Add Comment
Please, Sign In to add comment