playMaker

Author Topic: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy  (Read 1245 times)

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 254
I updated to latest Playmaker v1.9.7 and get now errors:

NullReferenceException: Object reference not set to an instance of an object
PlayMakerFSM.Awake () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:231)

NullReferenceException: Object reference not set to an instance of an object
PlayMakerFSM.OnDisable () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:691)

NullReferenceException: Object reference not set to an instance of an object
PlayMakerUtils.GetFsmEventSender () (at Assets/PlayMaker Utils/PlayMakerUtils_Events.cs:20)

How can I fix this?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7622
    • jinxtergames
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #1 on: June 28, 2023, 08:52:27 AM »
Hi.
Did you update from 1.9.1 directly to 1.9.7
(error is mentioning Playmaker_1.9.1)

first make a backup of your project if you did not do that yet.

Then try to delete playmaker, but copy out or leave the Resources folder (this hold the PlaymakerGlobals and PlaymakerPrefs

and reinstall

Then place back the resources folder

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 254
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #2 on: June 28, 2023, 12:43:16 PM »
I actually updated from 1.9.5 so yeah, it's weird that it shows an error related to 1.9.1.

I did as you say and deleted Playmaker folder entirely, then re-installed from package manager and run install from Playmaker window. I get this error at the end:

Unable to update following assemblies:Assets/PlayMaker/Editor/PlayMakerEditor.dll (Name = PlayMakerEditor, Error = 131) (Output: /var/folders/w5/y4l8442j1gd4sdk967p3lws00000gn/T/tmp4e247c90.tmp)

[AssemblyUpdater] Failed to resolve assembly System.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51. SearchPaths: Assets/PlayMaker/Editor, /Applications/Unity/Hub/Editor/2022.3.3f1/Unity.app/Contents/NetStandard/ref/2.1.0, /Applications/Unity/Hub/Editor/2022.3.3f1/Unity.app/Contents/NetStandard/compat/2.1.0/shims/netstandard

I ignore it and then put back the Resources folder with the globals.

I unfortunately get the exact same NullReferenceExceptions again when I hit play in the editor.

I also tried to uninstall the Playmaker Utils (deleted the folder) and re-installed from the ecosystem, yet same issue remains.

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 254
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #3 on: June 28, 2023, 11:15:50 PM »
So I went even further, deleted everything playmaker related, including the assets/plugins/playmaker folder, the utils folder, the ecosystem folder and the main playmaker folder. Reinstalled everything. Put pack the Resources folder and still, same error persists.

I'm lost. Nobody else is facing this problem?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7622
    • jinxtergames
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #4 on: June 29, 2023, 08:18:57 AM »
Hi,
I believe that there is also some stuff in the Plugin folder.

Does the error happen in editor mode or play mode?

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 254
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #5 on: June 29, 2023, 10:41:11 AM »
The plugin folder is the one I also deleted (see previous post).

It happens in play mode as soon as I send events with PlayMakerUtils.SendEventToGameObjectFsmByName()

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 254
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #6 on: June 29, 2023, 11:51:28 AM »
That's the event I send btw:
PlayMakerUtils.SendEventToGameObjectFsmByName(null, objToReceiveEvents, fsmName, eventNameInitialized, null);

The first variable to pass is a PlayMakerFSM fromFSM variable, is the problem that I set this to null? That worked well in the previous version but maybe it's not done the way it should in the first place?

I also set the last variable to null which is a FSMEventData.

In both cases I do not know what they do tbh.

Edit 1: for clarification, here the entire method that gets called.
void PlayMakerUtils.SendEventToGameObjectFsmByName(PlayMakerFSM fromFsm, GameObject target, string fsmName, string fsmEvent, HutongGames.PlayMaker.FsmEventData eventData)

Edit 2: in this thread https://hutonggames.com/playmakerforum/index.php?topic=15519.0 Jean says passing null is the way to go.
« Last Edit: June 29, 2023, 11:57:21 AM by Christoph »

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 254
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #7 on: June 29, 2023, 12:50:12 PM »
I think Playmaker Utils is broken and needs an update. I'm now starting to change all my events sent in c# scripts to the 'default' solution using the static utility method in PlayMakerFSM instead.

If anyone else is facing the problem, at the bottom of this page there's the solution:
https://hutonggames.fogbugz.com/default.asp?W329

Instead of using Playmaker Utils you just use:
Code: [Select]
PlayMakerFSM targetFSM = PlayMakerFSM.FindFsmOnGameObject(gameObjectWithFSM, fsmName);
targetFSM.SendEvent(eventName);

Seeing that additional packages can break this easily I think it's best to stick just with the default features of Playmaker.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #8 on: June 29, 2023, 05:48:18 PM »
Hi,

 Let me check, and see if I can repro, and I'll make an update if required. Else, we'll do a skype session so that I can actually see the project and debug it with you.

 Bye,

 Jean

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 254
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #9 on: June 30, 2023, 08:26:42 AM »
Thanks Jean. Changed now to the event option without utils. I was curious why do we have two options available and which one is really the better solution? Is there a difference in performance? Utils seems more powerful with more options. But I never understood how to use the event data for example. So my setup uses FSMName and Eventname only. Which is fine I guess with the other.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #10 on: July 03, 2023, 03:12:06 AM »
Hi,

It's the same perfs, but one has some of the utils tools embedded. I think basck in the days I made a sample showing the usages of event data, which were renamed event properties, this is why it's confusing I guess.

Give me a couple days, I am currently dealing with health issues, nothing dramatic, but I am not really in shape for tackling all this right now :)

Bye,

Jean

HamidKarimian

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #11 on: August 08, 2023, 11:58:42 PM »
Hi Jean!
Are there any updates on this?
I have the same problem.

I updated to 1.9.7, and non of my ugui component proxies work anymore.

NullReferenceException: Object reference not set to an instance of an object
PlayMakerUtils.SendEventToTarget (PlayMakerFSM fromFsm, HutongGames.PlayMaker.FsmEventTarget target, System.String fsmEvent, HutongGames.PlayMaker.FsmEventData eventData) (at Assets/PlayMaker Utils/PlayMakerUtils_Events.cs:44)
PlayMakerUGuiComponentProxy.FirePlayMakerEvent (HutongGames.PlayMaker.FsmEventData eventData) (at Assets/PlayMaker uGui/Proxies/PlayMakerUGuiComponentProxy.cs:523)
PlayMakerUGuiComponentProxy.OnClick () (at Assets/PlayMaker uGui/Proxies/PlayMakerUGuiComponentProxy.cs:357)
UnityEngine.Events.InvokableCall.Invoke () (at <ad50157ee00e45cdb3c8bd67012f8804>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <ad50157ee00e45cdb3c8bd67012f8804>:0)
UnityEngine.UI.Button.Press () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:70)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:114)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:57)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:272)
UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501)






Bump!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7622
    • jinxtergames
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #12 on: August 09, 2023, 07:58:01 AM »
Hi.
Ugui is outdated, i would suggest to update the Ugui actions with the (default) UI actions
and remove the Ugui actions.

before you do, make sure you have a backup of your project and/or preferable use some kind of version control like Github (desktop)

EpicMcDude

  • Playmaker Newbie
  • *
  • Posts: 45
Re: Playmaker 1.9.7 - NullReferenceException Playmaker Send Event Proxy
« Reply #13 on: September 13, 2023, 01:12:49 PM »
I'm actually getting this bug too. It took me a while to figure out it was coming from the Event Proxy script but it's definitely coming from this.
Quote
NullReferenceException: Object reference not set to an instance of an object
PlayMakerFSM.Awake () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:231)
UnityEngine.GameObject:AddComponent()
HutongGames.PlayMaker.Ecosystem.Utils.PlayMakerEvent:SanitizeFsmEventSender(PlayMakerFSM) (at Assets/PlayMaker Utils/PropertyDrawers/PlayMakerEvent/PlayMakerEvent.cs:65)
HutongGames.PlayMaker.Ecosystem.Utils.PlayMakerEvent:SendEvent(PlayMakerFSM, PlayMakerEventTarget, Boolean) (at Assets/PlayMaker Utils/PropertyDrawers/PlayMakerEvent/PlayMakerEvent.cs:99)
HutongGames.PlayMaker.Ecosystem.Utils.PlayMakerEventProxy:SendPlayMakerEvent() (at Assets/PlayMaker Utils/Wizards/PlayMakerEventProxy/PlayMakerEventProxy.cs:36)
CorpusEdax.FootstepProxy:Footstep() (at Assets/PlayMaker Custom Scripts/EventProxies/FootstepProxy.cs:23)

NullReferenceException: Object reference not set to an instance of an object
PlayMakerFSM.OnDisable () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:691)
UnityEngine.GameObject:AddComponent()
HutongGames.PlayMaker.Ecosystem.Utils.PlayMakerEvent:SanitizeFsmEventSender(PlayMakerFSM) (at Assets/PlayMaker Utils/PropertyDrawers/PlayMakerEvent/PlayMakerEvent.cs:65)
HutongGames.PlayMaker.Ecosystem.Utils.PlayMakerEvent:SendEvent(PlayMakerFSM, PlayMakerEventTarget, Boolean) (at Assets/PlayMaker Utils/PropertyDrawers/PlayMakerEvent/PlayMakerEvent.cs:99)
HutongGames.PlayMaker.Ecosystem.Utils.PlayMakerEventProxy:SendPlayMakerEvent() (at Assets/PlayMaker Utils/Wizards/PlayMakerEventProxy/PlayMakerEventProxy.cs:36)
CorpusEdax.FootstepProxy:Footstep() (at Assets/PlayMaker Custom Scripts/EventProxies/FootstepProxy.cs:23)

NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMaker.Ecosystem.Utils.PlayMakerEvent.SanitizeFsmEventSender (PlayMakerFSM fsm) (at Assets/PlayMaker Utils/PropertyDrawers/PlayMakerEvent/PlayMakerEvent.cs:66)
HutongGames.PlayMaker.Ecosystem.Utils.PlayMakerEvent.SendEvent (PlayMakerFSM fromFsm, HutongGames.PlayMaker.Ecosystem.Utils.PlayMakerEventTarget eventTarget, System.Boolean debug) (at Assets/PlayMaker Utils/PropertyDrawers/PlayMakerEvent/PlayMakerEvent.cs:99)
HutongGames.PlayMaker.Ecosystem.Utils.PlayMakerEventProxy.SendPlayMakerEvent () (at Assets/PlayMaker Utils/Wizards/PlayMakerEventProxy/PlayMakerEventProxy.cs:36)
CorpusEdax.FootstepProxy.Footstep () (at Assets/PlayMaker Custom Scripts/EventProxies/FootstepProxy.cs:23)

I'm not sure how to change to a static method since I used the Event Proxy tool and the script just looks like this

Code: [Select]
public class FootstepProxy : PlayMakerEventProxy {

[Button("Footstep","Test : Footstep")] public bool _;
public void Footstep()
{
if (debug || !Application.isPlaying)
{
Debug.Log("FootstepProxy : Footstep()");
}

       

base.SendPlayMakerEvent();
}
}

Could anyone point me to the right direction?

I'm on Unity 2022.3.7f1 and downgraded to Playmaker 1.9.4, no longer getting the errors above but now this error is preventing me from building the game:

Quote
NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMaker.Fsm.InitData () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1941)
PlayMakerFSM.OnAfterDeserialize () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:934)
UnityEditor.PrefabUtility:LoadPrefabContents(String)
HutongGames.PlayMakerEditor.ProjectTools:GetPrefabGameObject(String) (at Assets/PlayMaker/Editor/PlayMakerProjectTools.cs:152)
HutongGames.PlayMakerEditor.ProjectTools:DoPreprocessPrefabFSMs(List`1) (at Assets/PlayMaker/Editor/PlayMakerProjectTools.cs:278)
HutongGames.PlayMakerEditor.ProjectTools:DoPreprocessPrefabFSMsInBuild() (at Assets/PlayMaker/Editor/PlayMakerProjectTools.cs:115)
HutongGames.PlayMakerEditor.ProjectTools:PreprocessPrefabFSMs() (at Assets/PlayMaker/Editor/PlayMakerProjectTools.cs:57)
HutongGames.PlayMakerEditor.PlayMakerPreProcessBuild:OnPreprocessBuild(BuildReport) (at Assets/PlayMaker/Editor/PlayMakerBuildCallbacks.cs:31)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
« Last Edit: September 13, 2023, 03:20:02 PM by EpicMcDude »