Hi all,
I have a problem, I have a script attached to multiple GameObject with a box collider in a canvas.
In this script I have 4 Mouse Event for the same GameObject :
OnMouseDown => to create the same GameObject, but i can move it on the scene;
OnMouseDrag => to move the GameObject i’ve created with OnMouseDown;
OnMouseUp => to check if the GameObject isn’t on my canvas, if it is, I destroy it, or I restore his position/rotation in the last position before the movement;
OnMouseUpAsButton => to instantiate a window where i can rotate the GameObject as I want.
The probleme is that : OnMouseUpAsButton is called even if I move my mouse, so it create my window even if I just want to drag and drop the GameObject;
I think OnMouseUpAsButton doesn’t work perfectly in my case, need some suggestion to resolve this.
Thanks
You might also be interested in the EventSystem interfaces… if you’re using a canvas you already have the raycaster and eventsystem components/gameobjects in play…