Solved
UnityException: Transform child out of bounds (C# Unity)
On the Unity Editor this code helps me to get the Fog GameObject
//get the fog GameObject
//0 :day , 1:night
if (tzPlayInfo.Instance.ENV_01_IDX == 0)
{
if (FogEffect == null)
{
FogEffect = this.transform.GetChild(0).GetChild(2).GetChild(0).GetChild(4).gameObject;
}
} else
{
if (FogEffect == null)
{
FogEffect = this.transform.GetChild(0).GetChild(2).GetChild(1).GetChild(5).gameObject;
}
}
And here's what on my heirarchy 1.) 2.) As you can see on the photo it successfully gets the Fog GameObject . But when i build it and run the apk it gives me
UnityException: Transform child out of bounds at MC_SettingBehaviour.Update () [0x00000] in :0
Please help
That chain of GetChild()s is a pretty bad practice. Why not use GetComponentInChildren()?
Anyway, maybe this answer and that execution times in builds are different can explain the issue?
Transform.Find()
actually makes my Application Exit
Follow this Question
Related Questions
Vector3.MoveTowards moving transform 0 Answers
Transform search function only sporadically works?! 1 Answer
How to find the transform position of another gameobject then move a gameobject to that position? 1 Answer
GameObject not looking at me.. 1 Answer
Why does Unity lock the transform of prefabs in my scene in playmode? 0 Answers