Hi I’m experimenting with NC-Actions and Apex now and facing some problems.
Using this simple script:
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using UnityEngine;
using NodeCanvas;
using NodeCanvas.Variables;
using Apex;
using Apex.Steering;
namespaceNodeCanvas.Actions{
[Category("Apex")]
[AgentType(typeof(Transform))]
publicclassSeekTarget:ActionTask{
publicTransform other;
privateIMovable _unit;
protectedoverride voidOnExecute()
{
_unit=this.As<IMovable>();
Mover();
}
voidMover()
{
_unit.MoveTo(other.position,false);
EndAction(true);
}
}
}
I get a NullReferenceException for _unit.MoveTo, means that the referencing in OnExecute doesn’t work.
Additionally there comes a “Graph Error ‘Infinite Loop Detected’ on node Sequencer” which is also produced by this script, the rest of the BT works fine.
I believe that one problem is, nodeCanvas works in his own classes and Apex presumes classes derived from MonoBehaviour?
At any rate the Script without nodeCanvas-elements as simple Monobehaviour works, it comes from a Apex Path tutorial.
So how can I reference these Apex classes correctly?