I'm using the FadeObjectInOut script from the wiki (http://wiki.unity3d.com/index.php/FadeObjectInOut)
It's attached to two different objects (each), which trigger indiviudally. It'll resolve in
IndexOutOfRangeException: Array index is out of range.
FadeObjectIO.SetNewColor (UnityEngine.Renderer[] rendererObjects, Int32 i) (at Assets/Scripts/FadeObjectIO.cs:132)
It reffers to the line
Color newColor = (colors != null ? colors[i] : rendererObjects[i].material.color);
..., which tried to export as an function and still calls the same error. The whole code snippet relies on IEnumerator.
Due to the fact, that this only happens every now and then, I'm totally confused. I can't provoke it by triggering the events at the same time, I can't provok it by flashing between fadeOut and unIn super fast.
As solution, I tried things from the internet and also the "How to Avoid" of this question: What is an IndexOutOfRangeException / ArgumentOutOfRangeException and how do I fix it?
The last time, I triggered my oculus trigger on/off in high frequency and nothing happend. Frustrated I wanted to take the headset off and as I put down my controllers, it crashed again. (It's on the Touch trigger and thereby easily fast triggerable.)
I can't help myself anymore... Thanks for any advise
.
EDIT: below the thrown error + the debug code. After fading out, the Renderers are getting enabled=false. Since we are in a while loop, it doesnt really make sense to me tho, that the dot might've been already faded out (and it's renderer therby deactivated) being an error for the array - because it doesnt get any changes. Hmmmm.