i’m trying to build a killfeed in which the visual elements should be fading out at some point in time.
I have tried to access the property from my elements like this:
Hello, this sounds like it should work, are you sure you’re watching the correct VisualElement in the Game View? If you see it being modified in the UI Toolkit Debugger, it should be changing in the Game View as well for sure. If it’s not, you should report a bug (Help > Report a Bug) with a simple project showing how we can reproduce it.
Side note though, any reason why you’re not using the USS Transitions instead of controlling the change yourself with a scheduled change? Assuming you’re on Unity 2021.2+, USS Transitions (very similar to CSS Transitions) should be enough to do what you’re trying to do here.
I thank you for your reply! I got it working with both, using transitions and a scheduled item on my messages with ExecuteLater to set the opacity after a certain amount of time to 0.
Setting the opacity right away results in no transition at all even if i added a delay to the transition but i think that would be a normal behaviour.
Yes, you need to let it layout for at least 1 frame before you can have a transition happen, so it has an initial state, and then it will transition to the end state.