void Start() { player = gameObject.transform.parent.GetComponentInChildren<Player>(); //let's create the player items = new Items(); characters = new Characters(); if (items.LoadItems() && characters.LoadCharacters()) { prefab = Resources.Load(characters.GetCharacter("Guy").GetDirectory(), typeof(GameObject)); PlayerObject = Instantiate(prefab) as GameObject; PlayerObject.transform.position = new Vector3(0, 0.5f, 0); PlayerObject.transform.SetParent(gameObject.transform.parent.FindChild("PlayerObject").transform); for (int i = -4; i <= 4; i++) //initial 8 tiles { int rand = Random.Range(0, 2); item = items.GetItem(TilesArray[rand]); prefab = Resources.Load(item.GetDirectory(), typeof(GameObject)); ObjectI = Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject; ObjectI.transform.position = new Vector3(i * 9, 0, 0) + item.GetBasePosition(); ObjectI.transform.SetParent(gameObject.transform.FindChild("Tiles").transform); tiles.Add(ObjectI); } } }