Search Unity

Tip: Learning how to script stuff in the new UI?

Discussion in 'UGUI & TextMesh Pro' started by StarManta, Sep 4, 2014.

  1. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    It's been a common problem here that many people have had: "How do I script X to happen on RectTransforms?" The RectTransform inspector is very helpful for laying out, less helpful for making script functionality discoverable.

    The trick to learning what property does what: animation. Create a temporary Animator and AnimationClip, and in the editor (using record mode), move the UI element as you would like the script to change things. Now, look at what properties have been animated in the animation timeline. Those are the properties you want to set in your script!
     
    Last edited: Sep 4, 2014
  2. Fenyx

    Fenyx

    Joined:
    Aug 9, 2013
    Posts:
    8
    Came here looking for an answer to a specific problem. Left with the tools I needed to figure it out on my own.

    Thank you!
     
    Deleted User, Senshi and Tim-C like this.