How do you do to get the left button of mouse, the crypt didn't work when it was on the button? (Unity2d)



  • How do you do to get the left button of mouse, the crypt didn't work when it was on the button? (Unity2d)



  • There are two methods. MonoBehaviour One https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnMouseEnter.html Does it work when the mouse comes over the element, https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnMouseExit.html - when the mouse leaves the element. There's more. https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnMouseOver.html - but I think it's resource-intensive.

    Start the boulder variable. When the mouse comes over the elements, make a variable true♪ when you leave ♪ false♪ You check on the click if trueYou can't do anything.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2