Question by 
               Doomky · Apr 22, 2017 at 06:12 PM · 
                newbiemove an objectmovinggameobject  
              
 
              How do i change the position of my RectTransform
Hello, I don't understand why my scrit isn't working in this part i'm trying to move an object wich is in an Overlay canvas and I don't understand why it doesn't work. I've tried everything using his position, his local position, anchorred point and even the pivot and nothing seems to work... Here is my script:
     public void PrintBuff()
     {
         int length = Buffs.Count;
         for (int i = 0; i < length; i++)
         {
             Buff buff_i = Buffs[i];
             if (buff_i.BuffObjet == null)
             {
 
                 RectTransform buff_i_trans = this.gameObject.transform.FindChild("GUICanvas").FindChild("GUIBuff").GetComponent<RectTransform>();
                 buff_i.BuffObjet = GameObject.Instantiate(BuffObjetPrefab, buff_i_trans);
                 if (buff_i.BuffImage != null)
                 {
                     buff_i.BuffObjet.transform.FindChild("Image").GetComponent<Image>().sprite = buff_i.BuffImage;
                 }
                 buff_i.BuffObjet.GetComponent<Slider>().maxValue = buff_i.Duration;
                 if (!buff_i.IsBuff)
                 {
                     buff_i.BuffObjet.transform.FindChild("Fill Area").FindChild("Fill").GetComponent<Image>().sprite = Debuff;
                 }                
             }
             buff_i.BuffObjet.GetComponent<RectTransform>().anchorMin.Set(buff_i.BuffObjet.GetComponent<RectTransform>().anchorMin.x + i * 128, buff_i.BuffObjet.GetComponent<RectTransform>().anchorMin.y);
             buff_i.BuffObjet.GetComponent<Slider>().value = buff_i.Duration;
         }
     }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
How to move both objects when my player is mounted in another moving object? (eg: Skate, Car, Bike) 0 Answers
[Newby] Need help with navigating between a previous and next position 1 Answer
[Unity 2D] How to code a bomb-throwing enemy? 0 Answers
Need help on load sprites 1 Answer
Which version of Unity is more suitable for a pure 2D mobile game for a newbie? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                