Hi.
I try to make a script to have two different actions (TRANSFORM POSITION) on object depend on his position. But I don’t know how make this. Can you help me please. For exemple if the object position is (5,5,5) when you click (one mouse down) transform position (10,5,5) if you click after transform position (5,5,5).
Thanks
Use a variable to keep track of the current state of the object. If there are only 2 states, a bool
will suffice. Then, in your code when the player clicks, check the current state and do something different depending on what the current state is using an if
statement.
ok thanks but this code is in void update or void mousedown?
The variable should be an instance variable, not in any function. The rest you can do in OnMouseDown