UNITY | Project | RPG Tutorial |24.Inventory Menu

2
Input Manager
3
“Inventory Menu” Script
  • create variables,
    • bool to check whether the menu is on or not
    • the menu itself
  • in Update() method,
    • when ESC is pressed,
      • if the menu has not been opened,
        • stop the time by using timeScale
        • update the bool value
        • turn on the cursor
        • turn on the menu(inventoryMenu.SetActive(true))
      • if the menu has been opened
        • turn off the Menu
        • turn off the cursor
        • let the time go
4
Creating Inventory Menu with UI – RawImage
5
adding Script
6
Turn off the Menu as default
AC_55
InventoryMenu
  • when the menu is up,
    • we can still move Player’s Camera
    • the NPC still moves (without animaiton) because the destination object is still being updated
7
“NecroMancerWalkAI” Script
  • in Update() method,
    • make the transform of AI’s destination object relative to Time.timeScale
    • when timeScale is 0 there is no update in the object

 

8
“InventoryMenu” Script
  • in Update() method,
    • add code to enable or disable Player
9
Updating Script
AC_59
Inventory Menu Working