Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Repositioning ScrollRect through code. Bug or wrong method?

$
0
0
I'm not sure why this script isn't working. Is it possible set the position of a ScrollRect in this way? I'm trying to scroll to the top on enable.

Code (CSharp):
  1. private ScrollRect scrollRect;
  2. private bool ready = false;
  3.  
  4. void Awake() {
  5.     scrollRect = GetComponent<ScrollRect>();
  6.     if (scrollRect == null) {
  7.         Debug.LogError("GameObject does not have a ScrollRect component. GameObject name: " + gameObject.name + " tag: " + gameObject.tag);
  8.         Destroy(this);
  9.     }
  10. }
  11.  
  12. void OnEnable()...
Repositioning ScrollRect through code. Bug or wrong method?

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>