Update Stopped Working

Updated with scripts, sorry it’s long, I don’t know what’s causing the issue, so figured I’d include it all.

  • Yes I have looked through the forums!
  • My console messages ARE expanded
  • I have Debug.Log(“Test”) in Update, it is NEVER called
  • The Update was working fine for a few hours, then just stopped.
  • I deleted everything else in the Update and just tried it with the Debug.Log and it does nothing.

Are there any ever exceptions that would cause Update to not work? The only thing I can think of is that this is a base class (Creatures.cs, and then there’s another class that uses this as the ‘base’ class (sorry not a programmer, so technical terms might be off)).

Base Class

using UnityEngine;
using System.Collections;

public class Creature : MonoBehaviour {

	//Variables Hidden


	void Awake(){
		//burningFX = GameObject.Find (this.transform.name + "/CondiFX_Burning");
		burningFX = transform.Find("CondiFX_Burning").gameObject as GameObject;
		chilledFX = transform.Find ("CondiFX_Chilled").gameObject as GameObject;
		poisonedFX = transform.Find ("CondiFX_Poisoned").gameObject as GameObject;
		bleedingFX = transform.Find ("CondiFX_Bleeding").gameObject as GameObject;

	}


	void Update(){
		Debug.Log ("Updaaaate");  //This isn't called!

		if (burningTime > 0.01f){
			burningTime -= Time.deltaTime;
		} else if (burningTime <= 0.01f){
			burningTime = 0f;
			burningFX.SetActive (false);
			CancelInvoke("ApplyBurning");
		}
		
		if (chilledTime > 0.01f){
			chilledTime -= Time.deltaTime;
		} else if (chilledTime <= 0.01f){
			chilledTime = 0f;
			chilledFX.SetActive (false);
			CancelInvoke("ApplyChilled");
		}
		
		if (poisonedTime > 0.01f){
			Debug.Log ("7:  Poison has time on it");
			poisonedTime -= Time.deltaTime;
		} else if (poisonedTime <= 0.01f){
			poisonedTime = 0f;
			poisonedFX.SetActive (false);
			CancelInvoke("ApplyPoisoned");
		}
		
		if(bleedingTime > 0.01f){
			bleedingTime -= Time.deltaTime;
		} else if(bleedingTime <= 0.01f){
			bleedingTime = 0f;
			bleedingFX.SetActive (false);
			CancelInvoke("ApplyBleeding");
		}
	}

	//Called to add or remove health from the current health total
	public void AdjustCurHP(float healthAdjustment){
		if(curHP > 0)
			curHP += healthAdjustment;
	}

	//Apply Conditions, requires a condition and duration parameter.  Sets total condition time to += duration and activates the visual FX
	public void ApplyCondition(string condition, float duration){
		if(condition == "burning"){
			burningTime += duration;
			burningFX.SetActive(true);

			if(!IsInvoking("ApplyBurning"))
				InvokeRepeating("ApplyBurning", 0f, 1f);
		} else if (condition == "chilled"){
			chilledTime += duration;
			chilledFX.SetActive(true);

			if(!IsInvoking("ApplyChilled"))
				InvokeRepeating("ApplyChilled", 0f, 1f);
		} else if (condition == "poisoned"){
			poisonedTime += duration;
			poisonedFX.SetActive(true);

			if(!IsInvoking("ApplyPoisoned"))
				InvokeRepeating("ApplyPoisoned", 0f, 1f);
		} else if (condition == "bleeding"){
			bleedingTime += duration;
			bleedingFX.SetActive (true);

			if(!IsInvoking("ApplyBleeding"))
				InvokeRepeating("ApplyBleeding", 0f, 1f);
		}
	}

	//Invoked to repeat damage at tick intervals
	void ApplyBurning(){
		AdjustCurHP(-burningDMG);
	}

	void ApplyChilled(){
		AdjustCurHP(-chilledDMG);
	}

	void ApplyPoisoned(){
		AdjustCurHP(-poisonedDMG);
	}

	void ApplyBleeding(){
		AdjustCurHP(-bleedingDMG);
	}
	
}

Inherited Class

using UnityEngine;
using System.Collections;

public class SnowStatus : Creature {

	private float guiHPBarLength = 0f;
	private float screenH = 0;
	private float screenW = 0;
	
	private bool dead = false;
	
	void Start(){
		guiHPBarLength = ((Screen.width/2) * (curHP/maxHP));
		screenW = Screen.width;
		screenH = Screen.height;
	}

	void Update(){
		if (curHP > 0){
			guiHPBarLength = ((Screen.width / 2) * (curHP / maxHP));
		} else {
			guiHPBarLength = 0;
			Death();
		}
	}

	void Death(){
		SnowTPCon snowController = this.GetComponent ("SnowTPCon") as SnowTPCon;
		SnowTPCam snowCam = Camera.main.GetComponent ("SnowTPCam") as SnowTPCam;
		snowController.charControlled = false;
		snowCam.camFreeze = true;
		dead = true;
	}

Ahh. Since you are inherting a class other than monobehavior Update doesnt get called

MonoBehaviour calls the update function so you might wanna inherit fom that

If you have no idea what i am talking about

please do post your script

EG

public class Class1:BaseClass // as you can seee it is inheriting from Base calss
{

  void Update() //Does not get called
{

}
}

Using Mono as base class

 public class Class1:MonoBehaviour // as you can seee it is inheriting from Moni class
    {
    
      void Update() //Does get called
    {
    
    }
    }

Base Class

 public class BaseClass:MonoBehaviour // as you can seee it is inheriting from Base calss
    {
      public string MyName;
      public virtual void MyUpdate() //Changes the name from Update to MyUpdate for better Understanding the realtionship
    {
     Debug.Log("Hello" + MyName);
    }
    }

Okay as you can see that Class1 is inheriting from Base Class For now Think of Inheriting as Using as in terms of using varialbes in Parent class (in this case Base class)

Now if you attach the Class1 to game Object Class1 can acess all methods and variables of BaseClass.

So what you could do is

Class1

public class Class1:BaseClass // as you can seee it is inheriting from Base calss
{

public Class1
:
 MyName = " Bill Gates "; // As you can see you can acess the variable from Base Calss 

// Now lets call the Methoid of Base calss as you can see her you can directly acees the function 

MyUpdate();
}

void Start()
{
// Here you need to base.MyUpdate
 base.MyUpdate();
}
}

Hope You understood What i am trying to explain.If you have any doubts just ask.