ok i want to detect is a clone is active using a tag if (GameObject.FindGameObjectWithTag ("Medium").activeSelf) but the .activeSelf is not working and is not checking if the clone is active or not please i cannot go further into my game and i cant find anyone else with this error
//clone that are not active not register and skips the .activeself function ??
Answer by TBruce
Nov 19, 2016 at 10:03 PM
Take a look at the following snippet. I know it is a little more that you posted, but it will help you determine what the problem is.
if (GameObject.FindGameObjectWithTag ("Medium") != null)
GameObject go = GameObject.FindGameObjectWithTag ("Medium");
Debug.Log("Game object '" + go.name + "' is " + (go.activeSelf ? "active" : "inactive"));
// do something here
Debug.Log("There are no game objects with the tag of 'Medium'");
this is brilliant thankyou for helping me, ill see if this works sorry to be wasting your time ^>^
it works great thank you once again i was so sad that my game was dead as i thought it as a glitch, i gave you a reputation point, what ever that means. thanks!! ^.^ im still a learner...
Answer by studioAdam
Nov 19, 2016 at 10:03 PM
Hi @The_Cookie_Rooster. It's hard to tell without seeing more of your code and game but is the parent of your GameObject active? If not, this could be throwing you off. Perhaps try:
instead of activeSelf.
See the Unity docs here: https://docs.unity3d.com/ScriptReference/GameObject-activeInHierarchy.html
and here: https://docs.unity3d.com/ScriptReference/GameObject-activeSelf.html
I hope this helps.
thank you so much for putting your time for me ill try what you did. thank you so much for the reply ^.^
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
270 People are following this question.
Is it possible to copy and paste something from the Hierarchy in one Unity and paste it in another?
Parent is not active...but there is no parent!
Detecting Correct Numerical Order For Detecting Straight Flush
Why does this coroutine crash Unity?
UI Button not responding to Clicks or mouse hover