Will we be able to set a Canvas Active or Inactive via animation?

Can’t seem to be able to animate .setactive on a canvas in animations?

Original Post on Discord

by user 103054507105067008

Tried working around it by animating a parent for the canvas to set active/inactive and that didn’t work :confused:

by user 103054507105067008

You’re doing weird things again :smile:
Why are you not enabling/disabling the GameObject?

I want it to happen at a point of an animation on an exact frame I will make the canvas active

by user 103054507105067008

I am using the animation to set the Gameobject the canvas is under to active/inactive but it isn’t playing ball

by user 103054507105067008

What’s your usecase? Always have to differentiate between “random thing Unity supports we don’t want to support because it’s random” and “genuinely useful usecase”.

Click hotspot > panel animates open > panel animation enables Canvas gameobject at some point later during animation after it has finished animating open

by user 103054507105067008

I could otherwise write some coroutine with a countdown to show the canvas a few seconds into the animation otherwise?

by user 103054507105067008

I’ll see if I can animate the canvas scale so I can scale it up quickly via animation otherwise

by user 103054507105067008

Is this the error youre getting?
unknown.png

Yep! I think that is blocking it

by user 103054507105067008

Being able to animate hide/show of canvas is vital for projects where we are using that UI text/buttons around 3d objects, especially if they are 3d panels in the scene that animate in and out

by user 103054507105067008

So what seems to be happening is that the “activeSelf” animation of a gameobject is mapped to the component (any component, doesnt matter which one) instead of the object (so something produces a wrong animation pointer)

Ok found the error
unknown.png

It takes the Renderer which in this case is the canvas for an animation that is meant to be on the gameobject.

If you have anything to test just let me know!

by user 103054507105067008

It even outputs a warning because it couldnt resolve the correct object. Makes sense

Ah look like I’ve built a workaround for this before (on the typescript Renderer component) but the Canvas is no renderer.
unknown.png

I’m wondering if we should emit a gameObject component (something that only exists internally and only for the purpose for accepting and handling these special cases)

ok actually found a better solution