Hi, I’m trying to store the position and angle for each object, for each frame. (It is for a project not related gaming, so don’t worry about real-time performance.) I’d like to create a matrix of objects (each object containing the game object ID and position), but since I am new both to Unity and C#, I cannot get it to work. Based with the examples I wrote it like this:
[System.Serializable]
class ObjPosInfo
{
public string Obj_ID;
public float Pos_x;
public float Pos_y;
public float Angle;
public ObjPosInfo(string Obj_ID, float Pos_x, float Pos_y, float Angle)
{
this.Obj_ID = Obj_ID;
this.Pos_x = Pos_x;
this.Pos_y = Pos_y;
this.Angle = Angle;
}
}
void Start () {
ObjPosInfo[,] frameArray = new ObjPosInfo [numberOfFrames, GameObject.FindGameObjectsWithTag("box")];
}
When I try to execute, this error appears: Assets/test_script.cs(41,87): error CS0029: Cannot implicitly convert type UnityEngine.GameObject[]' to
int’. What am I doing wrong?