I have 2 game objects Jar and Key. Initially the key is inside the jar and when the user clicks on the jar , the key s position should change along the y axis, the key should pop up. This is what I did so far,
- created a new script called jar , assigned it to the jar game object an added an on click event and a JarClick method. I assigned the object Jar in Unity to this on click method.
Now inside this method I need to access the game object, key’s transform and change it. Can some one please help me do this. This is my Jar script so far
public class Jar : MonoBehaviour {
public Key showKey;
public void JarClick() {
}
}