NodeCanvas Forums › Support › [BUG] Disabling NavMeshAgent causes error spam
Disabling NavMeshAgent component causes error spam when NodeCanvas graph inspector window is open.
NodeCanvas v3.20
Unity 2020.3.5f1
Repro steps:
1. Create GO with NavMeshAgent and FSM owner and bake NavMesh on a plane.
2. Bind any NavMeshAgent property to blackboard.
3. Create setup like in the picture (important to have atleast 1 task has the bound property used.)
4. Press play and disable NavMeshAgent component.
5. Get spammed by this error as long as u have graph inspector open and focused.
“IsStopped” can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Hello,
You are right. It is a small bug related to task warnings. To fix this, please open up Task.cs file and replace the whole “GetWarningsOrError” method with the code bellow:
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 |
//Gather warnings for user convernience. Basicaly used in the editor, but could be used in runtime as well. virtual internal string GetWarningOrError() { var hardError = GetHardError(); if ( hardError != null ) { return "* " + hardError; } var userError = OnErrorCheck(); if ( userError != null ) { return userError; } if ( obsolete != string.Empty ) { return string.Format("Task is obsolete: '{0}'", obsolete); } if ( agentType != null && agent == null ) { if ( _agentParameter == null || ( _agentParameter.isNoneOrNull && !_agentParameter.isDefined ) ) { return string.Format("* '{0}' target agent is null", agentType.Name); } } var fields = this.GetType().RTGetFields(); for ( var i = 0; i < fields.Length; i++ ) { var field = fields<em class="d4pbbc-italic"></em>; if ( field.RTIsDefined<RequiredFieldAttribute>(true) ) { var value = field.GetValue(this); if ( value == null || value.Equals(null) ) { return string.Format("* Required field '{0}' is null", field.Name.SplitCamelCase()); } if ( field.FieldType == typeof(string) && string.IsNullOrEmpty((string)value) ) { return string.Format("* Required string field '{0}' is null or empty", field.Name.SplitCamelCase()); } if ( typeof(BBParameter).RTIsAssignableFrom(field.FieldType) ) { var bbParam = value as BBParameter; if ( bbParam == null ) { return string.Format("* BBParameter '{0}' is null", field.Name.SplitCamelCase()); } else if ( !bbParam.isDefined && bbParam.isNoneOrNull ) { return string.Format("* Required parameter '{0}' is null", field.Name.SplitCamelCase()); } } } } return null; } |
Only line #36 (as shown in above code lines) is changed actually, but I copy/pasted the whole method for your convenience.
Let me know if that works for you.
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
This does fix the issue allowing to view graph inspector without getting spam. However if u happen to select state node that has these variables in use same problem still persists.
Hello again,
You are right. Please open up BBParameterEditor.cs and change line #78 to the following:
if ( required && !string.IsNullOrEmpty(bbParam.name) && !bbParam.isDefined && bbParam.isNull ) { EditorUtils.MarkLastFieldWarning("An instance is required but currently resolves to null. If it is set in runtime you can ignore this warning."); }
Thanks 🙂
Join us on Discord: https://discord.gg/97q2Rjh