I am making a puzzle game that relies on a grid system.
I am storing the objects on the grid in a array so I can switch out parts of the level dynamically.
As you all know the instantiate spawns a object of the gameobject. So that is why I have to use objects unless I want to create a million unique wall prefabs and ruin the level generation code.(not random)
When it came time to move the player object I used transform.position as shown below.
public void MoveGridObject(int oldX, int oldZ, int newX, int newZ)
{
objectsInLevel [oldX, oldZ].transform.position = new Vector3 (newX, 0, newZ);
}
But when I try that Unity spits out this error message.
Assets/Scripts/LevelGeneration.cs(161,45): error CS1061: Type UnityEngine.Object' does not contain a definition for transform’ and no extension method transform' of type UnityEngine.Object’ could be found (are you missing a using directive or an assembly reference?)
This says that there is no such thing as transform for a object. So how do I move this object?
I am using the latest version of Unity as of june 15th 2015 and I run windows 8.1 64 bit. I dont know if that will be helpful or not.