Using Sequences in C# Scripts
Posted: Wed Feb 16, 2022 1:54 pm
Hello again! Today I'm trying to wrap my head around how to use the sequencer commands in a script. I'm creating a sort of loot box system, and am trying to implement the MoveTo() sequence to help.
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.
Thank you in advance! <3
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);
}