- Home /
Activating UI panel on GameObject Click/Destroy
I'm attempting to activate the animation of an informational image (part of a canvas/panel) upon the click of an object (that's also being destroyed because it's being collected).
I gave this a shot:
public GameObject panelUI;
public Animation panelAnim;
private void Start()
{
if ((panelUI != null) && (panelUI.GetComponent<Animation>() != null))
{
panelAnim = panelUI.GetComponent<Animation>();
}
}
void Update()
{
if ((Input.GetMouseButtonDown(0)) && (panelUI != null))
panelAnim.Play();
}
It's not letting me drag the animation or panel into the script. I'm obviously missing a lot here...Ultimately, this particular panel would only pop up(via the created animation) once the object is clicked. The object is already being destroyed upon click, so this panel animation is meant to follow.
Your answer
Follow this Question
Related Questions
Why isn't the animator getting my values? 0 Answers
Size GUiLayout 2 Answers
What's a good book to learn scripts for Unity? 1 Answer
Buttons remain in pressed state upon performing home interrupt 0 Answers
Draw GUI texture from it's center point. 2 Answers