// Use this for initialization void Start() { handler = GameObject.FindGameObjectWithTag("GameController").GetComponent<LevelBlockHandler>(); transform.parent = handler.transform; // This Loop is used to calculate the Size of the LevelBlock (the childrin inside) // the Size is used for the next Positioning for(int i = 0; i < transform.childCount; i++) { if(transform.GetChild(i).tag == "Ground") { if(transform.GetChild(i).GetComponent<BoxCollider2D>() != null) // childrenLenght is used for the reposition childrenLength += transform.GetChild(i).GetComponent<BoxCollider2D>().size.y; } } }
// Use this for initialization void Start() { // Get needed Objects levelHandler = GameObject.FindGameObjectWithTag("GameController").GetComponent<LevelBlockHandler>(); grounded = GameObject.FindGameObjectWithTag("GroundChk").GetComponent<GroundCheck>(); }