Question by 
               unity_s6WaJSdm6dtGzw · Oct 06, 2020 at 10:13 AM · 
                animationonmouseenteronmousedragonmouseexit  
              
 
              OnMouseEnter and OnMouseExit collide (I guess) and make an animation loop for no reason.
I wanted an animation(with white framing) play OnMouseEnter and stops OnMouseExit (this part works). I also implemented a dragging animation OnMouseDrag and everything worked well, when suddenly if were trying to drag an object in a certain way, where it does not understand if it is Enter or Exit, it stops on dragging animation and nothing works after that. I am just a newbie. :(
 Animator Window
 Animator Window
 Stuck Animation
 Stuck Animation
     private Vector3 screenPoint;
     private Vector3 offset; 
     private SpriteRenderer sprite;
     Animator anim;
 
  void Start()
     {
         anim = gameObject.GetComponent<Animator>();
         sprite = gameObject.GetComponent<SpriteRenderer>();
     }
 
     void Update()
     {
     }
 
     void OnMouseEnter()
     {
         anim.SetTrigger("Overtrue");
     }
 
     void OnMouseExit()
     {
         anim.SetTrigger("Overfalse");
 
     }
 
     void OnMouseDown()
     {
         offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
         anim.SetTrigger("Active");
     }
 
     private void OnMouseOver()
     {
         if(Input.GetMouseButtonDown(0))
         {
             anim.SetTrigger("Active");
 
         }else if (Input.GetMouseButtonUp(0))
         {
             anim.SetTrigger("Unactive");
         }
     }
 
     void OnMouseDrag()
     {
         OnMouseOver();
 
         Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0);
         Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
         transform.position = curPosition;
     }
 }
 
                 
                безымянныи.png 
                (39.4 kB) 
               
 
                
                 
                безымянныи1.png 
                (2.3 kB) 
               
 
              
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                