My existing code for this task is:
private VisualElement _creditSection;
private void Start()
{
var rootElement = uiDocument.rootVisualElement;
_creditSection = rootElement.Q("CreditSection");
Debug.Log(_creditSection.style.transitionDuration.value);
}
However, I am receiving null for this in console. I understand it's because the value is of object type, but I don't know how to get the value of the transition duration.
By chance, I discovered that I am able to get the value of transitionDuration
using this code:
print(_creditSection.resolvedStyle.transitionDuration.First().value);
It seems that _creditSection.style
is used for setting values, whereas resolvedStyle
is used for getting values. Utilizing LINQ, we can extract the first value of transitionDuration.