Hello everybody.
I found a tutorial on youtube to make a puzzle with pipes.
All interactions are done using the mouse and in order to integrate it into my project I would like to replace the action with the left click by pressing the interaction button.
here is the script used for the action on the left click of the mouse:
private void OnMouseDown()
{
transform.Rotate(new Vector3(0, 0, 90));
if (PossibleRots > 1)
{
if (transform.eulerAngles.z == correctRotation[0] || transform.eulerAngles.z == correctRotation[1] && isPlaced == false)
{
isPlaced = true;
gameManager.correctMove();
}
else if (isPlaced == true)
{
isPlaced = false;
gameManager.wrongMove();
}
}
else
{
if (transform.eulerAngles.z == correctRotation[0] && isPlaced == false)
{
isPlaced = true;
gameManager.correctMove();
}
else if (isPlaced == true)
{
isPlaced = false;
gameManager.wrongMove();
}
}
}
}
By what I would like to replace the OnMouseDown()?
Thx
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
OnMouseDown is a special function that detects mouse input. There isn't an equivalent for generic input detection. For that, you'd need to detect your input in an update loop:
However, this isn't involving AC - only the shared name of the "InteractionA" input you want to read. This is a topic for the general Unity forums.