0
\$\begingroup\$

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.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Hello and welcome to a StackExchange site. Just a note to let you know that when/if your question gets closed, you should edit it and work toward getting it reopened rather than deleting and creating another similar one. Please keep this in mind for your future questions :) \$\endgroup\$
    – Vaillancourt
    Commented Feb 15 at 16:06

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .