Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: coxy17 on May 18, 2018, 09:35:31 AM
-
Hi
I need to change the labels for FsmVar[] element names. Currently they are labeled as "Element 1", "Element 2" etc...
But I would want to change them to be unique, not incremental numbers at the end.
e.g. "Name", "Name zyz" etc...
Is this possible?
But more importantly im using [UIHint(UIHint.Variable)]. I have thought about adding in EditorGUILayout field, but i need boxes which im able to select local FSM variables from, from the action. But not been able to achieve this.
Nick
-
Hi.
I do not think that that is possible as it uses arrays or lists
and the elements are the index numbers.
So you might want to look into using hash tables.
Arraymaker (package on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)) has hashtables.
-
But more importantly im using [UIHint(UIHint.Variable)]. I have thought about adding in EditorGUILayout field, but i need boxes which im able to select local FSM variables from, from the action. But not been able to achieve this.
Nick
Hi,
Can you give your action code, I'll have a look at what can be done to allow local fsm var selection.
Bye,
Jean
-
I will send the code later on as im not at my PC
but all im using in my action is
[ArrayEditor(VariableType.Array)
public FsmVar[] values;
and then in the custom action editor i want to replicate this just with custom labels next to each value. Maybe using a property field and a for each statement to return the label and field.
EditorGUILayout.PropertyField
Then i need some form of additional script to populate those fields with dropdown like the [UIHint(UIHint.Variable)] field in the action.
-
Hi Jean,
Any update on this?
Nick
-
Hi,
Can you send me your action and editor so far?
Bye,
Jean
-
I've attached it.
-
Hi,
ok, sorry for the delay, was relaxing a bit last week...
so, I think I have something for you, which is basically how I did it for XmlMaker.
- you create a class that extends FsmStateAction class and you maintain your list of fsmVar
- you use this class as a public property inside your action
-- I have modified the custom action editor to edit this class and populate fsmVar inside this class.
This technic requires PlayMaker Utils set of tools, this removes a lot of the boiler plates needed to work with complex action editors. so I recommend you keep using these utils. Else you'll need to extract the various tools.
Let me know if this all make sense to you ok?
the major constraint as before is that the fsm var can only be the one from the fsm where the action is, not from the FsmOwnerDefault, in that case you'll need to use strings as the reference to the variable name on other fsms.
Bye,
Jean
-
Hi Jean
It's ok, hope you had a nice break.
I'll take a look later on thanks
Nick