playMaker

Author Topic: PlayerPrefs in Windows build - Could Not Create Action (ConditionalExpression)  (Read 761 times)

MlleBun

  • Playmaker Newbie
  • *
  • Posts: 28
Hi everyone,
I generated a build with with Development Build and Script Debugging on. When launching the exe, I have a game menu where I can launch a level. On level load, I have a couple of warnings in Unity's console, all concerning states that has a Conditional Expression action.

Are you familiar with those warnings in a build?
 
Code: [Select]
WindowsPlayer(user) Could Not Create Action: : Game_Save PlayerPrefs: PPrefs key get_lastAction_PLAYER: ConditionalExpression (Maybe the script was removed?)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogWarning(Object)
HutongGames.PlayMaker.ActionData:CreateAction(Context, Int32)
HutongGames.PlayMaker.ActionData:LoadActions(FsmState)
HutongGames.PlayMaker.FsmState:LoadActions()
HutongGames.PlayMaker.Fsm:InitData()
PlayMakerFSM:OnAfterDeserialize()

  • I'm using PlayerPrefs to save and load data in the game
  • I create all the keys at game init and I can see them in regedit
  • In the level that I launch, I have a state PPrefs key get_lastAction_PLAYER on a GO that has a Conditional Expression Action. When the event is true, it sends a event to a global transition found in the same FSM. The global transition is set so that it reloads the current level after a Wait action. (Load Scene action)

What is happening :
  • I have the warning stated above when the level is launched
  • The level does not reload in build as it does inside Unity in playmode

For now, I'm investigating this post https://hutonggames.com/playmakerforum/index.php?topic=18833.0
« Last Edit: March 13, 2021, 06:45:52 AM by MlleBun »

MlleBun

  • Playmaker Newbie
  • *
  • Posts: 28
Re: PlayerPrefs in Windows build - Could Not Create Action
« Reply #1 on: March 12, 2021, 04:17:08 PM »
Ok, the next test was to delete the global transition and have a normal state with transitions, but the result is the same. Same warnings on the states that has the Conditional Expression actions.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: PlayerPrefs in Windows build - Could Not Create Action
« Reply #2 on: March 12, 2021, 04:20:15 PM »
Unity is probably stripping the ConditionalExpression action when making the build.

You can make a link.xml file with this content to prevent stripping:

Code: [Select]
<linker>
       <assembly fullname="ConditionalExpression">
               <type fullname="PlayMaker.ConditionalExpression.*" preserve="all"/>
       </assembly>
</linker>

You can read more here:
https://docs.unity3d.com/Manual/ManagedCodeStripping.html#LinkXML

If you search the forums there's also a LinkerWizard that can generate this file based on the actions you're using.

Let me know if this solved the issue for you.

Edit: I added (ConditionalExpression) to the topic title for others running into this issue.
« Last Edit: March 12, 2021, 04:22:13 PM by Alex Chouls »

MlleBun

  • Playmaker Newbie
  • *
  • Posts: 28
That's great advice that I'm going to try immediately ! Many thanks 8) !

MlleBun

  • Playmaker Newbie
  • *
  • Posts: 28
And it works perfectly fine :D