Hello and sorry for the late reply due to summer vacation.
Thank you! I am glad you like NodeCanvas thus far 🙂
Please excuse me in advance if I misunderstood the question, but you can if required get a callback for the pointer-based unity events in actions. One way to do that, is by using the [EventReceiver] attribute, which accepts a params array of messages/events (in string names) to subscribe the action to, where the gameobject that would be used for those callbacks, will be the “agent”. Here is an example of how this can be done:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
usingUnityEngine;
usingUnityEngine.EventSystems;
usingNodeCanvas.Framework;
usingParadoxNotion.Design;
namespaceNodeCanvas.Tasks.Actions{
[EventReceiver("OnPointerDown","OnPointerUp")]
publicclassExample:ActionTask<Transform>{
privateboolpointerState;
protectedoverridevoidOnUpdate(){
if(pointerState){
EndAction();
}
}
voidOnPointerDown(PointerEventData eventData){
Debug.Log("Down");
pointerState=true;
}
voidOnPointerUp(PointerEventData eventData){
Debug.Log("Up");
pointerState=false;
}
}
}
Is this indeed what you’ve asked, or did I misunderstood the question.
Please let me know.
Thank you!
Join us on Discord: https://discord.gg/97q2Rjh
Login
Register
By registering on this website you agree to our Privacy Policy.