Discussions.unity.com

Health Script/Targeting system c#

WEBDestroy (gameObject); healthBarLength = (Screen.width / 2) * (curHealth / (float)maxHealth); } } The way This would be done would be by launching a projectile …

Actived: Just Now

URL: https://discussions.unity.com/t/health-script-targeting-system-c/62739

Segmented health bar with health amount selectable by player

WEBI have a simple health system where the player can take a set number of hits before dying. The player is able to choose how many hits they can take and I would …

Category:  Health Go Health

How do I make my healthbar change color depending on damage

WEBHello, I’m really stuck on my healthbar and could really use some help! I’m trying to make my healthbar go from green → yellow → red depending on how much …

Category:  Health Go Health

Health script, save health in between scenes. PlayerPrefs.

WEBPlayerPrefs.SetInt("healthP",currentHealth); } } save October 25, 2011, 6:09pm 2. Protect it by using DontDestroyOnLoad () between scenes. Only save health …

Category:  Health Go Health

How do I access Enemy current health variable in another script

WEBI have 2 scripts for my enemies health one which handles hits to the body and im trying to make another script that handles shots to the head basically I want this …

Category:  Health Go Health

regenerating health script

WEBI don't usually like writing people's code for them, but I don't have anything to do for the next 5 minutes, so here we go public float maxHealth = 100; public float …

Category:  Health Go Health

adding a health bar to the boss

WEBSo I made a code when I hit the boss 10 times it dies but I want to add a health bar to the code so when I hit the boss the health goes down. I made a simple …

Category:  Health Go Health

display the players current health on ui text

WEBAfter that you can change the content of the Text field in your script with the following code: HealthText.text = "Health: " + health; This code would make it display …

Category:  Health Go Health

Call a function based on percentage of health (int)

WEBHello all! I am wondering what the best way to run a function based on health percentage. Example: If enemy is below 70% health, do a cool mechanic. I have …

Category:  Health Go Health

How do I reset health

WEBHello everyone back again with another question. This is what is happening, my player dies then is returned to the level, the problem is he can’t move at all he just …

Category:  Health Go Health

How should I give gameobjects health

WEBIn your case I would probably make a script that contains health and other data that the objects that have health also have and name it UnitStats or UnitInfo. Just …

Category:  Health Go Health

Problems with taking damage

WEBI suspect there’s a method in the Enemy class called TakeDamage (int damageTaken). It should look something like this: private void TakeDamage(int …

Category:  Health Go Health

Decreasing health on (raycast)hit

WEBa few weeks ago i made a shooting script that uses a raycast for shooting. Currently it spawn a particle prefab on hit but i want it to decrease the health of that …

Category:  Health Go Health

Showing player health on UI

WEBShow I’ve set up my player health using floats as that’s how I know how to do it. But now I’m trying to implement UI. Mainly just the player health. I don’t want to …

Category:  Health Go Health

c# how to change player location on 0 hp

WEBThat Manager/Controller could be a singleton. Then, you have multiple ways to inform the manager, about the death of your player (reaching 0 health) 1- Create a …

Category:  Health Go Health

World Space canvas on top of "everything"

WEBAny world space Canvas items (eg, health bars), simply click to use that camera; also set “order in layer” to a high number. That’s it. In detail, using a layer so …

Category:  Health Go Health

How to I make ui in world space look at the player

WEBcbjunior June 25, 2017, 3:02pm 2. When you modify the rotation of the health bar object, which I’m assuming is a child of the enemy object, you need to make sure that you set …

Category:  Health Go Health

Slider Component Problem (Health Bar)

WEBHey guys! I’m creating simple health bar using slider, here is script: public class PlayerController : MonoBehaviour { public float moveSpeed; public float …

Category:  Health Go Health

image.fillamount doesnt decrease

WEBhi, i’m using the fill amount to change the health bar state, the value of decreasing depends on the weapon, i store the damage value in a variable called …

Category:  Health Go Health