// Use this for initialization void Awake() { anim = GetComponent <Animator>(); bodyRB = GetComponent <Rigidbody2D>(); helmet = transform.Find("bodyImg/head/helmet"); helmetScript = helmet.GetComponent <helmetFacing>(); weaponCtrl = transform.Find("weapon"); curWeapon = weaponCtrl.GetChild(0); //first child should be using weapon, if want to vaild, we can use CompareTag as well curWeaponSorting = curWeapon.GetComponent <SortingGroup>(); }
// Use this for initialization void Awake() { anim = GetComponent <Animator>(); bodyRB = GetComponent <Rigidbody2D>(); area = GameObject.Find("Main Camera/area").transform; areaLeftUpPT = area.Find("leftUpPT").position; areaRightDownPT = area.Find("rightDownPT").position; helmet = transform.Find("bodyImg/head/helmet"); helmetScript = helmet.GetComponent <helmetFacing>(); weaponCtrl = transform.Find("weapon"); curWeapon = weaponCtrl.GetChild(0); //first child should be using weapon, if want to vaild, we can use CompareTag as well curWeaponSorting = curWeapon.GetComponent <SortingGroup>(); UIobj = transform.Find("UI"); }