How do I grid of erros (mes.colors out of bounds)>
So I am making a flag blow in the wind with unity 5. Looks really cool. However, I get 2 errors whenever I click on the 'cloth'. The errors are below and pictures of the inspector are included. I am not sure why exactly.
===================================================== Mesh.colors is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array. UnityEditor.ClothInspector:OnEnable()
IndexOutOfRangeException: Array index is out of range. UnityEditor.ClothInspector.SetupSelectedMeshColors () (at C:/buildslave/unity/build/Editor/Mono/Inspector/ClothInspector.cs:337) UnityEditor.ClothInspector.OnEnable () (at C:/buildslave/unity/build/Editor/Mono/Inspector/ClothInspector.cs:249)
Answer by pitchforkjoe · Apr 05, 2016 at 02:35 AM
This appears to be a bug with ClothInspector: this occurs when you have a prefab with a Cloth component which has any Constraints edited.
Answer by Dr_D · Dec 16, 2016 at 05:29 AM
Hey guys... I was wondering if there is a workaround for this? I've searched a bit and haven't found anything. Using the latest version of unity. Simple model with one texture, used as a floppy hat on a character. Nothing special really... Just wondering why I'm getting this error. Thanks.
Answer by saclout · Jan 12, 2017 at 11:42 AM
I am not sure if you had the same problem as I had but for some reason the Cloth component and Skinned Mesh Renderer component switched position. I just had to make sure that the Skinned Mesh Renderer was on top of the Cloth component.
Hope it helps.
Did this work permanently? I tried your solution, even though I found it strange that component order in the inspector would be in anyway relevant.
Granted, it worked! :-)
Temporarily... :-(
Suspicious as I was, I restarted Unity and the problem persisted. I found that simply enabling and disabling the cloth component would also prevent the error messages. Again, not persistently.
I tried within an empty and simple scene to create a plane, associate it with a cloth component and make it a prefab. Upon clicking the prefab, the error message appears.
Thanks!
Hmm did you get rid of the $$anonymous$$esh Renderer? By adding cloth to a mesh Unity adds a Skinned $$anonymous$$esh Renderer and a Cloth Component to the GameObject but does not remove the $$anonymous$$esh Renderer. You don't need both so try removing it and keeping only the Skinned $$anonymous$$esh Renderer. Other than that I don't really see what the problem could be. Sorry if I can't help more.
Yes, Unity warns us about that, I did have it removed.
Thank you kindly for the answer anyway, Good luck! ;-)