I'm creating a text box that animates when it opens. Several of the pieces are set to invisible at the start, and are changed to visible via keys in the animation. It works properly when it runs, but I'm having issues with all of them becoming visible when I hit play. There's no code or anything doing this, so I'm at a loss. Is there a godot 4 bug related to this, or some other behavior I need to watch out for? Thanks.
#UI Invisibility Behavior
29 messages · Page 1 of 1 (latest)
I'm unable to recreate the issue here - objects toggle on visibility as expected
there is one instance where I can get it to become visible earlier, and that's by setting the track to continuous, meaning that when it reaches 0.5 in value it rounds up to 1 (which means visible)
however, the default for visibility is Discrete, which should just go from 0 to 1 when the keyframe happens
so you must have something else going on with your animation that's causing the issue
Hi, thanks for the reply. This is the animation. I even set them all to invisible in the animation to try and curb the problem.
When I scrub the playhead the animation works fine. When i play it at runtime it also works fine. but for some reason all the nodes set to invisible are visible when the scene first runs. playing the animation blinks them all invisible then the animations makes them visible again.
A little silly, but here's some screens of me scrubbing the animation 😅
are the nodes visible when you save the TSCN file?
because until the animation begins playing in the first place, it does not apply anything to the nodes' visibility or size
so you want your nodes to already be in their initial state when you first instance them
I have then set to invisible, saved in the editor. My first screen is what my tree looks like when I save, in case that's helpful.
Playing the level swaps them all visible, then playing the animations makes them invisible again. It's had me scratching my head all morning. Here's my local and remote tree as soon as i hit play, before playing the animation
For some reason Text is the only one that does not get forced visible.
that's very strange
do you have a RESET track where those elements are made visible?
and Reset On Save turned on
in which case, the elements would be made visible in the TSCN file, and would explain why they'd be visible when you first start the scene in play
I'm not sure. It auto created the reset tracks, but I don't know how they work so I have not looked at them. I'll have to take a look. What are the reset tracks for exactly?
Would I be better off deleting those?
It does appear the reset track is setting them visible...
The AnimationPlayer works by changing properties, so if you're editing your animation and you, I.E., change the position during an animation, the object's actual position is changing.
This might be fine in play where you have code control, but if you scrub and you don't go back all the way, you can end up saving your TSCN file and there you go, now your character is in the wrong spot as their initial position
that was a problem back in the day, so the concept of a RESET track was added. a RESET track is a track whose keyframes set the initial state of the properties, so you know your TSCN is in its normal initial state
so in your RESET track, you should set those keyframes to be invisible
it plays along with the 'Reset on Save' property on the animation player, which pretends that the RESET track was played to keyframe 0 right before saving the TSCN
and when you hit play, your scene is saved, so all your objects end up visible by default
but if your RESET track says they should be invisible, then they'll be saved as invisible instead
Well, that appears to have fixed it. Thank you kindly 🙂
Speaking of scrubbing though, I was having an issue earlier where playing the animation in the editor would go all the way to the start or the end. it'd get stuck about 0.1 before. Is that a known bug?
not to my knowledge