I like your solution as well as the condition 🙂 I think I will include this in the next version as well. The name property by the way, can be made easier, since BBParameter already overrides ToString(), thus to return a nice label automatically 🙂
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
namespaceNodeCanvas.Tasks.Conditions{
[Category("✫ Blackboard")]
[Description("Check if a boolean variable is true and if so, it is immediately reset to false.")]
publicclassCheckBooleanTrigger:ConditionTask{
[BlackboardOnly]
publicBBParameter<bool>trigger;
protectedoverridestringinfo{
get{returnstring.Format("Trigger {0}",trigger);}
}
protectedoverrideboolOnCheck(){
if(trigger.value){
trigger.value=false;
returntrue;
}
returnfalse;
}
}
}
With that said though, I think that if you want to actually check if a button is clicked, then maybe using the “UGUI/Button Clicked” condition could be a better option depending on your use case.