- Home /
OnMouseDown works where OnMouseUp fails
Hey there. I've got a sprite with the following code attached:
void OnMouseUp ()
{
if(renderer.enabled)
Application.LoadLevel(m_layoutTarget);
}
For some reason, this does not work. Instead, it reloads the same level. m_layoutTarget
is a string and is defined correctly and the line IS triggered appropriately, as tested by a breakpoint. However, when I use OnMouseDown, it does work, and perfectly so! Does anyone have any idea what could be causing this strange behaviour?
Answer by andyspeak · May 06, 2014 at 01:43 PM
hmmm well if it is loading the same level then the button is loading cos you get the load
or ther is a mouse down in a script thats activating 1st cos u need to mouse down before up
but if you change it to mouseDown it depends what one is running 1st
have a look if you have more mouse downs being called
my last advice is use Application.LoadLevel("level name as string"); works too and if you add levels you dont need to worry about the order
Yeah, I mean literally replacing On$$anonymous$$ouseDown with On$$anonymous$$ouseUp. Disabling this function means no behaviour happens. m_layoutTarget
is a string.
Your answer
Follow this Question
Related Questions
Raycast examples needed - alternative to OnMouseDown, OnMouseUp 1 Answer
Load scene when right click button is released not working 1 Answer
OnMouseOver Problem 3 Answers
C# MOUSE EVENT TOGGLE 1 Answer
Calling method once 2 Answers