- Home /
I can not I find an object hidden
Hi everyone
I have a problem
When an object will hide, by the code
gmaeObject.Find ("hideObject")
I can not find it!?
http://unity3d.com/support/documentation/ScriptReference/GameObject.Find.html "This function only returns active gameobjects."
Answer by Wolfram · Aug 07, 2010 at 10:35 AM
To still be able to use the object you can
- initially set the object to active. find the object in Awake() and keep a reference. then set the object to inactive (probably in Start()).
- disable the renderer, not the object
- instead of Find(), create a public var and drag the object in the inspector onto that script
- if you know the relative location of the object to your script in the hierarchy, you can reach the object via the hierarchy (transform.parent or the children of the transform)
If the renderer to disable not only the object seen! But Scripts, Collision,... not stop!
Please don't post further questions as answers, use the commenting function for that. Read my answer for other solutions, if disabling the renderer does not solve your problem.
to the first option. Assign it to a variable so you can keep track of it ins$$anonymous$$d of Find()ing it again.
Answer by AliAzin · Aug 07, 2010 at 10:04 AM
What do you mean by "hideObject" . if you mean disabling it, then you can not find it. But if you disable the renderer, you can simply find it.
Your answer
Follow this Question
Related Questions
How do i GET the the YRotation of an object? 4 Answers
How you find an Object 1 Answer
A quick way to find the root parent? 2 Answers
send object in sendMessage 1 Answer
JS, get child 2 Answers