- Home /
Make UI element only appear if object is present (unity 4.6)
I have an energy bar that only applies to a certain item, and so i want it to disappear whenever the object is not present.
you need to give more details. What do you mean it applies to a single item, and what does "present" mean?
if it there. as in it has been instantiated, but not destroyed. I tried
if(GameObject.Find("Laser")==null){
destroy(gameObject, 0);
}
and it works fine, but i want it to be able to reapear later on if it is instantiated again
Sorry, but I still don't quite get it...
Give a detailed explanation as to the exact feature you want to implement, from the beginning.
Answer by 767_2 · Nov 08, 2014 at 03:58 PM
one option is to attach your UI element to your gameobject so when it destroys the ui element will disappear
that's a great idea! but will it need to have a separate canvas?
this doesn't work. it will follow the object. i want it to take up the whole screen like a normal UI