- Home /
Collider population and animation events
Hello Unity friends,
I am experiencing quite an unusual bug that has only recently popped up within my current game. To break it down, I have around five scripts that call something like xcollider = GameObject.Find("xobject").GetComponent<Collider>();
in the start and/or awake functions. This method has worked with Unity 5 before and still routinely works with other objects such as scripts. This issue only seems to effect colliders within the Unity Editor.
Oddly enough, over the last week or two, I have had continuous issues with these functions (searches) not firing when the scene starts. The really weird part is, it fires when I first get into Unity, but as soon as I edit a script or an animation the Unity Editor will suddenly "forget" to populate these fields. This occurrence happens on multiple game objects and for several different colliders, all with different scripts and calls.
This breaks down even further when, causing young-age baldness, colliders that ARE found at Start/Awake will randomly stop working when activated by animation events. The trouble is, neither the code nor the animation events have been touched for a few weeks, so nothing changed within them when this error started to occur. The colliders will enable/disable around 60% of the time, but the other 40% will mysteriously not fire at all. This has no correlation to being in contact with other colliders, characters, entities, or other scripts that my team and I can find.
I am wondering if anyone else is experiencing this issue, or if it just happens to be some hidden bug from some other random script in our project that is messing with it. I have poured over thousands of lines of code in the past few days searching for any inconsistencies, but I can't seem to find anything related to this issue.
Any help is appreciated and I am sorry for the longer post.
TLDR; My colliders wont populate in Unity after the first few minutes and/or when changes are made and they sometimes misfire even when initially found in inspector.