Hello,
I’m trying to build something like a puzzle. Images are already at the correct spot but not with the correct rotation. The player has to click on the image to turn them.
I guess I’m making an error because this is not working. I find some topics such as OnMouseDown on another object - Questions & Answers - Unity Discussions dealing about that but I haven’t managed to reproduce it.
Here is the code I have so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Rotate : MonoBehaviour
{
public GameObject Object_A_Tourner;
void OnMouseDown()
{
transform.Rotate(new Vector3(0f, 0f, 90f));
}
}
This code is apply to my 25 images, at this time nothing is moving when I click on one of them.
Have you any though?
Cheers,
Mathieu