playMaker

Author Topic: A FSM template including RunFSM action raises error after import  (Read 1691 times)

mhamanaka

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 5
Hi, as I didn't receive any confirmation email after bug-report, I'm posting the bug info here.
(How long will the usual delay of confirmation email? I expect it to be smaller than several minutes but may be not.)

1) What happened

* importing and clicking a FSM asset (attached GazeEvent.asset) raises error and I couldn't edit it (PlayMaker 1.9.1 p4).
* The same asset can be loaded with PlayMaker 1.9.1 p3, but error icon appears on RunFSM action in it. (error detail below)
* it has no error on PlayMaker 1.9.0

The error on PlayMaker1.9.1p4
Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
HutongGames.GUIStyleHelpers.Draw (UnityEngine.GUIStyle guiStyle, UnityEngine.Rect rect, System.String text) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/HutongGames/Extensions/GuiStyleHelpers.cs:20)
HutongGames.PlayMakerEditor.FsmEditorGUILayout.DrawHintText (System.String text, System.String hint, System.Single yOffset) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmEditorGUILayout.cs:90)
FsmTemplateEditor.OnInspectorGUI () (at Assets/PlayMaker/Editor/FsmTemplateEditor.cs:42)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass55_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <3e481e8f36eb4d4c8d94b9ba6b2be438>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

The error detail (1.9.1p3)
Code: [Select]
System.ArgumentNullException: Value cannot be null.
Parameter name: collection
  at System.ThrowHelper.ThrowArgumentNullException (System.ExceptionArgument argument) [0x00006] in <437ba245d8404784b9fbab9b439ac908>:0
  at System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x00009] in <437ba245d8404784b9fbab9b439ac908>:0
  at HutongGames.PlayMaker.FsmTemplateControl.InitOverrides () [0x000da] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\CustomActionTypes\FsmTemplateControl.cs:367
  at HutongGames.PlayMaker.FsmTemplateControl.Init () [0x00009] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\CustomActionTypes\FsmTemplateControl.cs:324
  at FsmTemplateControlEditor.Init () [0x00000] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\CustomActionTypes\Editor\FsmTemplateControlEditor.cs:65
  at FsmTemplateControlEditor..ctor (HutongGames.PlayMaker.FsmTemplateControl fsmTemplateControl) [0x0002b] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\CustomActionTypes\Editor\FsmTemplateControlEditor.cs:60
  at FsmTemplateControlEditor.GetEditor (HutongGames.PlayMaker.FsmTemplateControl fsmTemplateControl) [0x0000f] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\CustomActionTypes\Editor\FsmTemplateControlEditor.cs:40
  at HutongGames.PlayMakerEditor.ActionEditor.EditFsmTemplateControl (System.Object fieldValue) [0x00010] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:1966
  at HutongGames.PlayMakerEditor.ActionEditor.GUIForFieldTypes (System.String labelText, System.Type type, System.Object fieldValue, System.Object[] attributes) [0x00194] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:979
  at HutongGames.PlayMakerEditor.ActionEditor.EditField (System.Object obj, System.Reflection.FieldInfo field, System.String labelText, System.Type fieldType, System.Object fieldValue, System.Object[] attributes) [0x0000c] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:620
* Also, the error can trigger much more weired behaviors on building executable, after it raise error during OnPlayMakerBuildCallbacks.OnPostProcessScene(). The behaviors are: make calling AssetDatabase.CreateAsset() fail, make Unity Editor GUI unresponsive.

2) How can we reproduce it

* Create a fresh PlayMaker 1.9.1 p4 project
* Import these 2 FSM template files in the attachment.
* Clicking GazeEvent asset on Project view, it will raise `NullReferenceException: Object reference not set to an instance of an object`

Environment: Unity2019.3.6f1, Windows 10
« Last Edit: March 17, 2021, 10:09:02 AM by mhamanaka »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: A FSM template including RunFSM action raises error after import
« Reply #1 on: March 17, 2021, 03:45:24 PM »
Hi thanks for the bug report. I can repro this, but the error goes away if the main editor is open. Does that also fix it for you? Do you still get build errors with the main editor open?

This will be fixed in 1.9.1p5, but wanted to check if the workaround works for you. I will also PM you about an invite to the beta group.

mhamanaka

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 5
Re: A FSM template including RunFSM action raises error after import
« Reply #2 on: March 17, 2021, 11:30:29 PM »
Hi thanks for the bug report. I can repro this, but the error goes away if the main editor is open. Does that also fix it for you? Do you still get build errors with the main editor open?

This will be fixed in 1.9.1p5, but wanted to check if the workaround works for you. I will also PM you about an invite to the beta group.

Yes, the error went away if I open the main PlayMaker editor window via Unity menu. And the error during build was fixed also. I didn't find that as the Edit button was disabled on the inspector.
Great to hear that the issue will be fixed in the next release.
Also I hope to try the beta version.

Thanks,

mhamanaka

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 5
Re: A FSM template including RunFSM action raises error after import
« Reply #3 on: March 19, 2021, 11:39:50 AM »
Hi thanks for the bug report. I can repro this, but the error goes away if the main editor is open. Does that also fix it for you? Do you still get build errors with the main editor open?

This will be fixed in 1.9.1p5, but wanted to check if the workaround works for you. I will also PM you about an invite to the beta group.

Hi Alex, thank you for inviting me to the beta tester, I just done the test with 1.9.1p5 beta version (updated today).
And the results are mixed.

* The issue when selecting GazeEvent.asset on Unity Editor was fixed! It shows 'Edit' button on the inspector. Thank you!
* The error on build seems to be not fixed yet. So I create a package to reproduce the problem.

This is the steps to reproduce:
* prepare a Unity project with PlayMaker (better to install iTween support also).
* unzip the attachment to Assets folder
* include SampleScene2 scene to the "Scenes In Build" list of Build Settings.
* build. (any platform)
* it will output an executable, but in the console, it will output some errors and also the Unity Editor start to behave strangely (UI will not reflesh without resizing window/views).

Tested with Unity 2019.3.6f1 / Windows 10

The error log:
Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMaker.FsmTemplateControl.CopyOutputVariables (HutongGames.PlayMaker.FsmTemplateControl source) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/CustomActionTypes/FsmTemplateControl.cs:276)
HutongGames.PlayMaker.FsmTemplateControl..ctor (HutongGames.PlayMaker.FsmTemplateControl source) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/CustomActionTypes/FsmTemplateControl.cs:193)
HutongGames.PlayMaker.ActionData.CopyFsmTemplateControlParams () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/ActionData.cs:500)
HutongGames.PlayMaker.ActionData.Copy () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/ActionData.cs:179)
HutongGames.PlayMaker.FsmState..ctor (HutongGames.PlayMaker.FsmState source) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:129)
HutongGames.PlayMaker.Fsm..ctor (HutongGames.PlayMaker.Fsm source, HutongGames.PlayMaker.FsmVariables overrideVariables) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1603)
PlayMakerFSM.InitTemplate () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:286)
PlayMakerFSM.Preprocess () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:236)
HutongGames.PlayMakerEditor.PlayMakerBuildCallbacks.OnPostProcessScene () (at Assets/PlayMaker/Editor/PlayMakerBuildCallbacks.cs:70)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.Build.BuildPipelineInterfaces+AttributeCallbackWrapper.OnProcessScene (UnityEngine.SceneManagement.Scene scene, UnityEditor.Build.Reporting.BuildReport report) (at <3e481e8f36eb4d4c8d94b9ba6b2be438>:0)
UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass16_0.<OnSceneProcess>b__1 (UnityEditor.Build.IProcessSceneWithReport spp) (at <3e481e8f36eb4d4c8d94b9ba6b2be438>:0)
UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) (at <3e481e8f36eb4d4c8d94b9ba6b2be438>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

If I save the GazeEvent template before I build, the error will not happen.
But I hope this error to be fixed, because I see same-looking error logs at several other cases like loading (old) asset bundles which utilizes FSM templates and RunFSM actions.

I attach these other errors, in case it helps:
Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMaker.FsmTemplateControl.CopyOutputVariables (HutongGames.PlayMaker.FsmTemplateControl source) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/CustomActionTypes/FsmTemplateControl.cs:276)
HutongGames.PlayMaker.FsmTemplateControl..ctor (HutongGames.PlayMaker.FsmTemplateControl source) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/CustomActionTypes/FsmTemplateControl.cs:193)
HutongGames.PlayMaker.ActionData.CopyFsmTemplateControlParams () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/ActionData.cs:500)
HutongGames.PlayMaker.ActionData.Copy () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/ActionData.cs:179)
HutongGames.PlayMaker.FsmState..ctor (HutongGames.PlayMaker.FsmState source) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:129)
HutongGames.PlayMaker.Fsm..ctor (HutongGames.PlayMaker.Fsm source, HutongGames.PlayMaker.FsmVariables overrideVariables) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1603)
PlayMakerFSM.InitTemplate () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:286)
PlayMakerFSM.Init () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:253)
PlayMakerFSM.SetFsmTemplate (FsmTemplate template) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:538)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
HutongGames.PlayMaker.Actions.CallMethod.DoMethodCall () (at Assets/PlayMaker/Actions/ScriptControl/CallMethod.cs:127)
HutongGames.PlayMaker.Actions.CallMethod.OnEnter () (at Assets/PlayMaker/Actions/ScriptControl/CallMethod.cs:66)
HutongGames.PlayMaker.FsmState.ActivateActions (System.Int32 startIndex) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:222)
HutongGames.PlayMaker.FsmState.OnEnter () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:192)
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:3072)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:3011)
HutongGames.PlayMaker.Fsm.UpdateStateChanges () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2944)
HutongGames.PlayMaker.Fsm.Start () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2168)
HutongGames.PlayMaker.Fsm.OnEnable () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2107)
PlayMakerFSM.OnEnable () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:612)
UnityEngine.GameObject:SetActive(Boolean)
STYLY.MR.STYLYSceneState:ShowSTYLYScene() (at Assets/STYLY-MobileViewer/FSM/State/STYLYSceneState.cs:501)
STYLY.MR.STYLYSceneState:BeginEnter(IContext) (at Assets/STYLY-MobileViewer/FSM/State/STYLYSceneState.cs:124)
SimpleFSM.StateMachine:set_State(IState) (at Assets/SimpleFSM/StateMachine.cs:61)
SimpleFSM.<Execute>d__5:MoveNext() (at Assets/SimpleFSM/StateMachine.cs:43)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMaker.FsmTemplateControl.CopyOutputVariables (HutongGames.PlayMaker.FsmTemplateControl source) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/CustomActionTypes/FsmTemplateControl.cs:276)
HutongGames.PlayMaker.FsmTemplateControl..ctor (HutongGames.PlayMaker.FsmTemplateControl source) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/CustomActionTypes/FsmTemplateControl.cs:193)
HutongGames.PlayMaker.ActionData.CopyFsmTemplateControlParams () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/ActionData.cs:500)
HutongGames.PlayMaker.ActionData.Copy () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/ActionData.cs:179)
HutongGames.PlayMaker.FsmState..ctor (HutongGames.PlayMaker.FsmState source) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:129)
HutongGames.PlayMaker.Fsm..ctor (HutongGames.PlayMaker.Fsm source, HutongGames.PlayMaker.FsmVariables overrideVariables) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1603)
HutongGames.PlayMaker.FsmTemplateControl.InstantiateFsm () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/CustomActionTypes/FsmTemplateControl.cs:231)
HutongGames.PlayMaker.Fsm.CreateSubFsm (HutongGames.PlayMaker.FsmTemplateControl templateControl) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1653)
HutongGames.PlayMaker.Actions.RunFSM.Awake () (at Assets/PlayMaker/Actions/StateMachine/RunFSM.cs:52)
HutongGames.PlayMaker.Fsm.Awake () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1845)
HutongGames.PlayMaker.Fsm.Init (UnityEngine.MonoBehaviour component) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1872)
PlayMakerFSM.Init () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:274)
PlayMakerFSM.Awake () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:229)
UnityEngine.Object:Instantiate(GameObject, Vector3, Quaternion)
HutongGames.PlayMaker.Actions.CreateObject:OnEnter() (at Assets/PlayMaker/Actions/GameObject/CreateObject.cs:99)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:222)
HutongGames.PlayMaker.FsmState:OnEnter() (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:192)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:3072)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:3011)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2944)
HutongGames.PlayMaker.Fsm:UpdateState(FsmState) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:3088)
HutongGames.PlayMaker.Fsm:Update() (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2231)
PlayMakerFSM:Update() (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:624)

Regards,
Makoto

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: A FSM template including RunFSM action raises error after import
« Reply #4 on: March 19, 2021, 01:33:29 PM »
Thanks for the clear repro steps! This will be fixed in the next build.

mhamanaka

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 5
Re: A FSM template including RunFSM action raises error after import
« Reply #5 on: March 20, 2021, 05:38:24 AM »
Thank you!! :)

mhamanaka

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 5
Re: A FSM template including RunFSM action raises error after import
« Reply #6 on: March 21, 2021, 11:46:37 PM »
Thanks for the clear repro steps! This will be fixed in the next build.

Hi, I tested with updated beta p5 and all problems above were solved!
Thank you very much!