- Home /
Question by
austin998 · Apr 02, 2018 at 03:42 AM ·
c#unity 2drotateclick objects
How to left click to rotate a box in a same direction in Unity 2D?
I have a project here that want me to make a box rotate 90 degrees when clicked on Unity C#. It need to be rotate in a constant direction which is rotate to right 90 degrees every time i click. Can anyone show me some example how to code it? Thanks.
Comment
Best Answer
Answer by mgear · Apr 02, 2018 at 08:51 AM
if (Input.GetMouseButtonDown(0))
{
transform.Rotate(0,90,0);
}
https://docs.unity3d.com/ScriptReference/Transform.Rotate.html
$$anonymous$$y puzzle game is started with randomized direction pieces of puzzle. What if i need to do like when the direction is right the game will end by it's own? What should i add in?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Why does my swiping code not work? 1 Answer
Rotating while rotating? 1 Answer
How to make Respawn script with time 1 Answer