Search Unity

Please explain prefabs and hierarchy

Discussion in 'Immediate Mode GUI (IMGUI)' started by wingsoptional, Nov 18, 2014.

  1. wingsoptional

    wingsoptional

    Joined:
    Nov 18, 2014
    Posts:
    1
    Doing my first Unity Tutorial and so far it's going pretty well however - everytime it says remove the item from the hierarchy - it's gone and I can't access it anymore.
    for example in the space shooter tutorial - i create the asteroid and all works, but when i get to the Game Controller stage, I remove the asteroid from Hierarchy - but then there's nothing in my prefabs to link to my Game Controller where it's wanting the "hazard".

    Can anyone explain this to me please.
     
  2. NickHaldon

    NickHaldon

    Joined:
    Mar 19, 2014
    Posts:
    128
    I haven't done the space shooter tutorial before so I don't exactly know what you do in it. It seems to me that what's happening is that you haven't created a prefab of the asteroid.

    What you do to make a prefab is to go into you project window thing and right-click. Mouse over the new panel and select prefab from there. It will make a new instance of a prefab in your project. After its made name it anything you want and then simply drag your asteroid from the hierarchy onto the prefab and its done. Your asteroid is now a prefab in your project.

    So to finish up, where the Game Controller wants the "hazard" just drag the prefab up into it and it should work. if you need an explanation of how the Prefabs and stuff work I can explain that.

    Good luck!
    NickHaldon