Git Product home page Git Product logo

create-healthbar-ui-toolkit's Introduction

View the entire tutorial on What Up Games.

Create a health bar that hovers over the player with UI Toolkit

It’s very important to provide the player with status updates on how a character is doing. There’s a wide array of scenarios where this is applicable, but two very common ones are a health bar or a status meter. I recently implemented this behavior in my own game as a status bar that increases over time to show when a guard is becoming more and more alert to your actions. This tutorial will go over the same mechanics that I used to create a runtime bar, but apply them to a health bar that hovers over the player and enemies.

Example

Learning Outcomes

There are two ways that you can achieve this within your game. This tutorial will only focus on one of the techniques - which is translating a position from world space to screen space. By the end of this tutorial you will be able to:

  1. Understand the difference between your two options.
  2. Design a health bar UI using the UI Builder tool.
  3. Add a runtime UI to your game.
  4. Manipulate the UI by converting world point to screen point.
  5. Toggle the visibility of a visual element.

Prerequisites

  1. You will need Unity 2020.3 LTS or later to follow along.
  2. This tutorial assumes you already have basic knowledge of Unity and intermediate knowledge of C#.
  3. Basic understanding of UI Toolkit and UI Builder.

Tutorials may work with earlier versions. The version referenced is the on I used.

Resources

  1. “Official” UI Toolkit Runtime documentation

Additionally, this project uses the following free assets (thanks guys!):

  1. Low Poly Water by Ebru Dogan
  2. Pirate Kit by Kenney

create-healthbar-ui-toolkit's People

Contributors

yecats avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.