Adding collectable - GreenBlackSky/the_steam_song GitHub Wiki

  1. Import the item model into the Meshes folder and its material into the Materials folder.
  2. Create new prefab in the Prefabs folder, using the mesh and the material.
  3. Open the prefab to edit it.
  4. Choose the item in the Hierarchy and in the Inspector add a new Collider component.
    • If the item has the a physical collider, a new collider must be a little bigger.
  5. In the Inspector, choose created collider component and check the "Is trigger" checkbox.
  6. Add "Collectable.cs" script to items components.
  7. Add icon to item (see Adding icon to object )

Here you go! Add the prefab to the game, than run it. When the hero is near the new item (when they trigger the collider) an 'F' button appear on the screen. Press it, and the item should disapear. Open the inventory with an 'I' button and the items icon should be there.