|
I am looking for all objects in a hierarchy that have meshes. This includes the object itself and any of its children. The purpose is to attach a mesh effect. If I use: It finds the first mesh and works fine. But as I want to have all meshes I am trying the following: This doesnt find any meshes and I am completely confused to why.
(comments are locked)
|
|
Ok, I've found my own answer. I put the result of the find straight into the for loop. I have no idea why it didnt work when the result in an array but the following works a treat:
(comments are locked)
|
|
Is it even getting to the for loop? It's possible that you can't cast a MeshFilter[] to a boolean, and so always returns false! Try instead, see if that works any better. That gets me: NullReferenceException: Object reference not set to an instance of an object Its driving me buggy..... In theory I shouldnt even need the if condition statement, I ought to be able to drop straight into the loop but produces the same as the above error.... (worth a try though)
Nov 06 '11 at 01:26 PM
Fabkins
Well, that means that meshes isn't getting assigned properly! Is all of this happening inside a function? I'm afraid I can't really help you much more here, I'm not that good at JavaScript (I could help you if it were C# though)
Nov 06 '11 at 01:33 PM
syclamoth
Hi syclamoth, yes its happening in a function. The bit I just dont understand is why getting the first instance works but getting an array of all of them doesnt. Thanks for your suggestions anyhow.
Nov 06 '11 at 01:40 PM
Fabkins
(comments are locked)
|
