NodeCanvas Forums › Support › [BUG] Disabling NavMeshAgent causes error spam › Reply To: [BUG] Disabling NavMeshAgent causes error spam
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