Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to get node size after it is instantiated?

Discussion in 'UI Toolkit' started by D-DutchDave, Jun 28, 2022.

  1. D-DutchDave

    D-DutchDave

    Joined:
    May 4, 2018
    Posts:
    36
    Hello!

    I'm wondering if anyone here knows how one can get the node size after it is being created. I've tried the following methods but they do not return any useful value:
    • GetPosition().width (returns 0)
    • node.style.width.value.value (returns NaN)
    • node.resolvedStyle.width (returns NaN)
    Is there any other way for me to read the nodes current width? Thanks in advance!
     
  2. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    313