Now if I am correct when the Objective is completed it runs it twice because my CurrentObjective int goes up by 2 instead of 1… in my code it is only listed to go up once?
public bool ObjComplete;
public int CurObj;
public GameObject[] TheObjective;
public bool CurObjUsingText;
public Text StoryTextLine1;
public Text StoryTextLine2;
Objective[] objective;
void Awake () {
objective = new Objective[TheObjective.Length];
for(int i = 0; i < TheObjective.Length; i++){
objective _= TheObjective*.GetComponent<Objective> ();*_
* }*
* }*
* void Update () {*
* if (ObjComplete) {*
* ObjComplete = false;*
* // If the obj was using text, Remove text on completion*
* if(CurObjUsingText){*
* StoryTextLine1.text = “”;*
* StoryTextLine2.text = “”;*
* CurObjUsingText = false;*
* }*
* // Disable old objective*
* objective [CurObj].enabled = false;*
* // Set new objective*
* CurObj += 1;*
* // Enable the new objective*
* objective [CurObj].enabled = true;*
* objective [CurObj].ControllerObj = this.gameObject;*
* objective [CurObj].StoryTextLine1 = StoryTextLine1;*
* objective [CurObj].StoryTextLine2 = StoryTextLine2;*
* }*
* }*
I want it to run the script as soon as the ObjectiveProcessing script sets the ObjComplete to true which should set the current Objective to what it was +1 to move it to the next and then enable it