In the script I'm using, I have an array for the different objects you can find in the boxes, and I want to use the command to move the image of the object to an empty game object on the canvas. I'm a little worried doing a simple transform on the object to a location may get messed up as the camera moves around in the game.
This is the script so far. I'd like to add a line in the Onbuttonpress void that moves the moniObject being called forward to an empty gameobject.
Code: Select all
public Moni[] monis;
[System.Serializable]
public class Moni
{
public string moniName;
public GameObject moniObject;
public int rating;
}
public void Onbuttonpress()
{
int moniIndex = Random.Range(0, monis.Length);
Debug.Log("you have invited " + monis[moniIndex].moniName);
Debug.Log("They are a " + monis[moniIndex].moniObject);
}