Forum rules - please read before posting.

Player health

I’ve set up a player health system using triggers to reduce a global variable Health, and food to increase the variable. There are checks to ensure the value does not rise above 100 or fall below 0. The player is notified through Action List dialogue as to the changes in health. I would like to show the health value in a UI slider but can’t see how to link the variable with the slider value. Can it be done?

Comments

  • So long as the variable is a float, it can.

    A Slider element in the Menu Manager can have its Slider affects value set to Float Variable, and then its Global float var set to the variable.

    You'll also need to uncheck User can change value? for it to be read-only.

  • Thank you for the help Chris. I can’t find a slider affects element in any of the menus. I’ve set up a new menu with Unity UI in Scene as the source and Slider as the element type but that’s as far as I can get

  • Use Unity UI Prefab unless you have a specific need to use In Scene.

    With Unity UI, however, you need to first create your menu using Unity UI and then connect the elements to AC. A tutorial can be found here.

  • Hi Chris. Thank you for the additional help, and the tutorial. It’s working perfectly now. Thank you again

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.