I’ve just tried out upgrading to NC2, removing all previous NodeCanvas scripts/support assets, deleting my pre-existing graphs and refactoring my custom actions/conditions. The issue I’m currently having is the following:
– I have my re-factored actions
– I create a new FSM and setup a single action state with my CustomAction
– The graph can be authored without any issues
– I hit play, and immediately the NC FSM Graph ‘loses’ my custom action.
– After I exit play mode, the graph still has lost my action
To example exactly what I mean by ‘lose’ please check the attached screen grab.
Note if I re-author the graph by removing this action and re-adding it, it once again appears fine until I hit play, at which point it again loses the action.
Creating a clean project from scratch and re-creating this test action works fine so perhaps it’s something conflicting in my pre-existing 1.6 project that I haven’t cleaned properly.
I’m going to try it from fresh again perhaps I missed something in the cleanup, I’ll let you know how I get on soon,
That seems so weird since of course there is no special treating to the included ones.
Can you please confirm and let me know if it works fine in a new test project?
Doing a clean from scratch sorted it out, I’m not exactly sure what I missed previously, but all’s good.
On an upgrade note, I use
protected override string OnInit()
In some conditions, however this function no longer seems to be called, I was wondering if there is an alternative to do some condition ‘state setup’ that I require. (Specifically I have a condition that listens for a game event, the listener is attached in the OnInit, then when the callback is received it yield returns).
Glad to know its all sorted out. By they way there was another (irelevant) deserialization bug I’ve found which fix is not in the version I’ve send to some of you but it’s of course in the submited version. I’d recomend you wait asset store release before commiting to some work or I can resend it to you of course.
With that said and regarding OnInit,
OnInit and other attribute related initialization is not done in tasks that do not define an AgentType (either with the attribute [AgentType] or with using the generic version of the task eg: : ActionTask ).
This is simply done for performance, but I had this request from other people as well, so I may revert it to call initialization anyway.
Here are the 2 option for now:
1. Define an AgentType if that is indeed needed, which at least in my case, most if not all tasks requiring some initialization were also using an AgentType definition.
2. Open up Task.cs and in method ‘Set’ remove lines #323-324:
1
2
3
4
5
if(agentType==null)
returntrue;
Dont worry about doing this since I will also do it in one way or another due to request.