Hey,
i have two classes, the first one updates “properties” and sends an Event with the new Data. The second class reacts on the event and does something with the “properties”-Values.
the first class looks like this:
for(int i = 0; i < availableGestures.Count; i++) {
gesture = availableGestures[i];
properties.title = gesture.title
try {
newPropertiesAvailable(properties);
} catch {
//Debug.LogWarning("No listener attached to the PropertiesHandler!");
}
}
Here is the second class:
private String title;
public void Enter() {
Generator.newPropertiesAvailable += new Generator.PropertiesHandler(updateProperties);
}
public void Update() {
if (title.Equals("Step")) { //This is never true and i dont know why :(
Debug.Log("AAAA");
}
}
private void updateProperties(GestureProperties properties) {
title = properties.title;
if (title.Equals("Step")) { //This is true
Debug.Log("BBBB");
}
}
i dont understand why in updateProperties(…) the title is “Step” and in Update() the title isnt “Step” ![]()
in Update() the title has always the value of my last value in the first clas in the for loop.
in my first clas e.g. the for loop contains [0] = “step” and [1] = “bla”. then in the second class in Update() my title is always “bla” and in the updateProperties(…) methode it is first “step” and then “bla”.
Thanks for your help!