Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: blackant on January 23, 2023, 06:56:06 AM

Title: Bug with an Enum variable
Post by: blackant on January 23, 2023, 06:56:06 AM
Hello,

I encountered a problem with an Enum.
It was working always, and suddenly seems to be lost

I use a sciptable object
Get property of this one as an Enum
click on Store New Variable wich seems to register correctly,
But when i go to the variables, it is set to None/None
If i change to the right Enum Type, then it's removed from the action

Plus if i let the created variable setin the action, and go to the variables and go back to the steate immediately,
I have an error message and th UI is not right.
see the screenshot
Title: Re: Bug with an Enum variable
Post by: blackant on January 23, 2023, 07:03:02 AM
System.ArgumentException: Field targetProperty defined on type HutongGames.PlayMaker.Actions.GetProperty is not a field on the target object which is of type HutongGames.PlayMaker.FsmProperty.
Parameter name: obj
  at System.Reflection.RuntimeFieldInfo.SetValue (System.Object obj, System.Object val, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) [0x00045] in <c2a97e0383e8404c9fc0ae19d58f57f1>:0
  at System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) [0x00009] in <c2a97e0383e8404c9fc0ae19d58f57f1>:0
  at HutongGames.PlayMakerEditor.ActionEditor.DoVariableSelector (UnityEngine.GUIContent label, HutongGames.PlayMaker.Fsm fsm, HutongGames.PlayMaker.VariableType variableType, HutongGames.PlayMaker.NamedVariable selected, HutongGames.PlayMaker.VariableType typeConstraint, System.Type objectConstraint) [0x0003e] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:2856
  at HutongGames.PlayMakerEditor.VariableEditor.DoFsmEnumPopup (UnityEngine.GUIContent label, HutongGames.PlayMaker.Fsm fsm, HutongGames.PlayMaker.FsmEnum fsmEnum, System.Type objectType) [0x00000] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\VariableEditor.cs:1114
  at HutongGames.PlayMakerEditor.VariableEditor.FsmEnumPopup (UnityEngine.GUIContent label, HutongGames.PlayMaker.Fsm fsm, HutongGames.PlayMaker.FsmEnum fsmEnum, System.Type objectType) [0x0000b] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\VariableEditor.cs:1122
  at HutongGames.PlayMakerEditor.ActionEditor.EditFsmProperty (System.Object fieldValue, System.Object[] attributes) [0x008c0] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:1733
  at HutongGames.PlayMakerEditor.ActionEditor.GUIForFieldTypes (System.String labelText, System.Type type, System.Object fieldValue, System.Object[] attributes) [0x00611] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Editor\Classes\ActionEditor.cs:1121
  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:617
Title: Re: Bug with an Enum variable
Post by: djaydino on January 24, 2023, 02:50:32 AM
Hi.
You should not use Properties actions with scriptables.
(also minimize using Properties actions as a general)

Its best to create some custom actions to access the scriptable data.

see this thread :
https://hutonggames.com/playmakerforum/index.php?topic=20829.msg95642#msg95642

And this video for example : (you can google more by searching Playmaker Scriptable)