Health bar system.

Hello! I’m trying to create a simple health bar system for an enemy but keep getting stuck. A very simple health bar system with just the coding in, not GUI health bar yet… just trying to get the coding done… I code in the player script that has the raycast and hit-info and attack damage set to the player and then I have another separate script for the enemy that has it’s health. My problem is accessing the attack damage from the player raycast script to subtrack from the enemie’s health when attacked. Could anyone point me in the right direction? Thanks!

This section will probably be of great help to you. Between these tutorials, Youtube tutorials, and the Unity docs (found here: Unity - Manual: Unity User Manual 2022.3 (LTS)), you should be all set!

Hope this helps!