For some reason, when i attempted to make a FPS health and damage script it doesnt work at all and it returns an error. debug.log says “The referenced script on this behavior is missing!” when i click it it shows
“The referenced script behavior is missing!
UnityEditor.AssetDatabase:LoadAssetAtPath(String, Type)
VizioComponentEditor:a()
VizioComponentEditor:RenderGizmo(Transform, GizmoType)”
and at the very bottom of the console window it says:
Assert in file: C:/BuildAgent/work/300357e52574df36/Editor/MonoGenerated/Editor/EditorGuiUtility.cs at line: 330
this was a fresh install, opened for the first time after re-installing.
my code is supposed to give my player health, and then make bullets that touch the player remove that health by subtracting “damage” from current health until it reaches 0. however nothing at all happens, can anyone help me figure this out? im a bit lost.
PlayerHealth.js
public var playerCurHp;
public var playerMaxHp;
playerCurHp = 100;
playerMaxHp = 100;
if(playerCurHp > playerMaxHp){
playerCurHp = playerMaxHp;
}
if(playerCurHp < 0){
playerCurHp = 0;
}
if(playerCurHp < 1){
//die
// Die();
Debug.Log("YOU DIED!");
}
//function Die () {
//Application.LoadLevel (Application.loadedLevel);
function ApplyDamage (damage : int) {
playerCurHp -= damage;
Debug.Log(playerCurHp);
}
**ApplyDamage.js**
var damage = 10;
function OnCollisionEnter (col : Collision) {
col.gameObject.BroadCastMessage("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);
}