- Home /
 
               Question by 
               jure006 · Jul 01, 2017 at 10:30 AM · 
                unity 5uitriggerscroll view  
              
 
              How to trigger OnValueChange(Vector 2) method from code?
I'm using Unity UI - Scroll View and now i want to trigger its OnValueChange without changing value, i just want to trigger it from the code. I've tried with Invoke function but i cant figure out what is current Vector 2. Please HELP, i'm searching for this solution for a long time and i can't figure it out. :/
               Comment
              
 
               
              Answer by jure006 · Jul 01, 2017 at 12:11 PM
I've found solution!!!
I've just wrote function that changes value like this:
 void ScrollValueTrigger()
     {
         Vector3 numVec = MyScrollRect.GetComponent<RectTransform>().position;
         for (int i = 0; i < 1; i++)
         {
             Vector3 vec = new Vector3(i, i, i);
             MyScrollRect.GetComponent<RectTransform>().localPosition = vec;
         }
         MyScrollRect.GetComponent<RectTransform>().position = numVec;
     }
So simple at the end ;)))
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                