MINING QUEST: ‘Clean up the Hierarchy’ - Solutions

Quest: Mining Quest
Challenge: Clean up the Hierarchy

Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.

Ok, here is the last one I finished yesterday. Tonight I will try the remaining challenges :slight_smile:

I just added this line everywhere a tile/food/exit is instantiated.

newFloorTile.transform.SetParent(transform);
1 Like

I used newFloorTile.transform.parent = parentObject.transform;

This one was really easy.

  private void InstantiateRockTile(int x, int y)
    {
        GameObject newRockTile = Instantiate(rockTilePrefab, new Vector2(x, y), Quaternion.identity);
        newRockTile.GetComponent<SpriteRenderer>().sprite = rockSprites[Random.Range(0, rockSprites.Length)];
        newRockTile.transform.parent = newParent;
    }

Privacy & Terms