CTF案例中的问题:当设置Defence的站岗位置时,老师在视频上教的是定义局部变量,然后用同步去设置Transform,但我点击同步按钮时,报空引用异常。具体的报错很长。
NullReferenceException: Object reference not set to an instance of an object
BehaviorDesigner.Editor.VariableInspector.AddPropertyName (BehaviorDesigner.Runtime.SharedVariable sharedVariable, UnityEngine.GameObject gameObject, System.Collections.Generic.List`1& propertyNames, System.Collections.Generic.List`1& propertyGameObjects, Boolean behaviorGameObject)
BehaviorDesigner.Editor.VariableInspector.ShowPropertyMappingMenu (BehaviorDesigner.Runtime.BehaviorSource behaviorSource, BehaviorDesigner.Runtime.SharedVariable sharedVariable)
BehaviorDesigner.Editor.VariableInspector.DrawSharedVariable (IVariableSource variableSource, BehaviorDesigner.Runtime.SharedVariable sharedVariable, Boolean selected)
BehaviorDesigner.Editor.VariableInspector.DrawAllVariables (Boolean showFooter, IVariableSource variableSource, System.Collections.Generic.List`1& variables, Boolean canSelect, System.Collections.Generic.List`1& variablePosition, System.Int32& selectedVariableIndex, System.String& selectedVariableName, System.Int32& selectedVariableTypeIndex, Boolean drawRemoveButton, Boolean drawLastSeparator)
BehaviorDesigner.Editor.VariableInspector.DrawVariables (IVariableSource variableSource, Boolean enabled, BehaviorDesigner.Runtime.BehaviorSource behaviorSource, System.String& variableName, System.Boolean& focusNameField, System.Int32& variableTypeIndex, UnityEngine.Vector2& scrollPosition, System.Collections.Generic.List`1& variablePosition, System.Single& variableStartPosition, System.Int32& selectedVariableIndex, System.String& selectedVariableName, System.Int32& selectedVariableTypeIndex)
BehaviorDesigner.Editor.VariableInspector.DrawVariables (BehaviorDesigner.Runtime.BehaviorSource behaviorSource, Boolean enabled)
BehaviorDesigner.Editor.BehaviorDesignerWindow.DrawPropertiesBox ()
BehaviorDesigner.Editor.BehaviorDesignerWindow.Draw ()
BehaviorDesigner.Editor.BehaviorDesignerWindow.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)