public static void InstantiateObject(int x, int z, int y, Tile.ID id, WorldObjectContainer worldObjects) { GameObject obj = WorldObjectFactory.Instantiate(x, z, y, id); if (obj == null) { return; } ObjectData objData = obj.AddComponent <ObjectData>(); objData.Init(worldObjects, id, x, z, y); worldObjects.SetObject(x, z, y, obj); obj.transform.SetParent(worldObjects.GetParent()); }