Let me first start off by stating that I am a complete noob when it comes to Unity. I am working in 2d mode. I have imported an assest I created. The assets is a simple square shape with the letter “A” on the face up side and the letter “B” on the face down side. I want to know how “on Mouse down” the “A” side goes face down and the “B” side is now face up. So essentially the asset would turn 180 degrees on it’s axis. Any help would be much appreciated.
If you want to rotate sprite on mouse click by 180,
void Update()
{
if (Input.GetMouseButtonDown(0))
m_MySprite.transform.Rotate(0, 180, 0);
}
refer this 1
I’m a little new to Unity myself but this should get you going in the right direction.
Add the script to both of your game objects, and I believe this will rotate them by 180 degrees on the z axis if you click on them. If it doesn’t work, feel free to play around with it. Oh! And make sure you google what each of these things do so you know what’s going on ( which will essentially make you better at tailoring Unity code to what you want)
void Update() {
if ( Input.GetMouseButtonDown(0) )
transform.rotation = Quaternion.AngleAxis( 180, new Vector3(0, 0, 1) );
}