Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: blackant on August 23, 2018, 06:03:28 AM

Title: Global Variables Categories bug
Post by: blackant on August 23, 2018, 06:03:28 AM
Hello,

a small bug i encountered today while iw as cleanning my project, adding ToolTips and categories to my variables, suddenly, the inputs were not correct like on this screen, only for one variable
Title: Re: Global Variables Categories bug
Post by: blackant on August 23, 2018, 06:21:09 AM
i think this message is related to this bug:
ArgumentNullException: Argument cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary`2[System.Type,System.String].ContainsKey (System.Type key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:458)
HutongGames.PlayMakerEditor.VariableTypeMenu.IsTypeAliased (System.Type type) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmPrefabs.cs:669)
HutongGames.PlayMakerEditor.FsmObjectEditor.DoTypeSelector () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/BugReportWindow.cs:119)
HutongGames.PlayMakerEditor.FsmVariablesEditor.EditVariableValue () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/ActionEditor.cs:301)
HutongGames.PlayMakerEditor.FsmVariablesEditor.DoVariableEditor () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/ActionEditor.cs:267)
HutongGames.PlayMakerEditor.FsmVariablesEditor.OnGUI () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/GlobalVariablesWindow.cs:132)
HutongGames.PlayMakerEditor.GlobalVariablesWindow.DoGUI () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/ActionEditor.cs:3112)
HutongGames.PlayMakerEditor.BaseEditorWindow.OnGUI () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/CanvasView.cs:605)
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)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
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:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:255)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

i restarted unity bug the bug is still there
Title: Re: Global Variables Categories bug
Post by: jeanfabre on August 24, 2018, 03:18:29 AM
Hi,

 Can you file a bug report via the PlayMaker menu? thanks :)

 Bye,

 Jean
Title: Re: Global Variables Categories bug
Post by: blackant on August 24, 2018, 03:51:59 AM
to late, i deleted the variable and replaced by the same new one
sry
Title: Re: Global Variables Categories bug
Post by: djaydino on August 24, 2018, 09:00:56 AM
hi.
Off topic.. you have a lot of globals there.
You should try to reduce that.
My global count never exceeds 10 and most of the time i have 1 or 2

Try using more get/set fsm actions there are also a whole bunch of custom action on the Ecosytem to do some math with them directly (for example 'Fsm Int Add)
Title: Re: Global Variables Categories bug
Post by: blackant on August 24, 2018, 09:17:35 AM
Get FsmVariable is less expensive than global variables ?

i used global to avoid to recall them between each because i use a lot of different scenes, but i'm not a specialist with coding
Title: Re: Global Variables Categories bug
Post by: djaydino on August 24, 2018, 11:48:00 PM
Hi,

Check out these links :

https://hutonggames.fogbugz.com/default.asp?W1462

http://hutonggames.com/playmakerforum/index.php?topic=14313.msg66420#msg66420
Title: Re: Global Variables Categories bug
Post by: blackant on August 25, 2018, 03:18:41 AM
good to know, i think i had a bad approach of using my variables.

thanks, i ll have to rewrite a big part of my game,

but could you clarify the interest of the global variables if only 2 / 3 must be used  ?
Title: Re: Global Variables Categories bug
Post by: djaydino on August 25, 2018, 05:57:44 AM
Hi.
I only use globals to reference a gameobject (for example 'gameManager' or statsManager)
Mainly for prefabs.

Else if a prefab is spawned it would need to do a 'find gameObject' which is 'Expensive' performance wise.

if you use only a few its ok, but if you spawn or pool many prefabs then it better to use a global.
Title: Re: Global Variables Categories bug
Post by: blackant on August 27, 2018, 03:05:35 AM
today after re-opening my project i got another error linked directly to this old and new variable with the same name. they are both missing.

so before reworking the whole FSms, i share this and i understand better why this is better to avoid them..