playMaker

Author Topic: Set FSM Name change, or string. Ways to change the name of the FSM at run time?  (Read 2422 times)

Stuksgens

  • Playmaker Newbie
  • *
  • Posts: 9
hello every all 

Sorry my english because I'm still learning # google.translate   :P

Since I started using the playmaker in my projects, something always bothered me. That it was not having something that could put a name on the FSM. Or at least change it at run time. (Or at least do not know currently)
This has never bothered me so much, but lately, it is disturbing me a lot because as some already know, there is the template that are the ways in which I can save some FSM and use them at run time for several objects at the same time. However, to use the project perfectly I would need to change the name of the FSM, something I can not do. And in the current project more than 300 different FSMs have this problem and did not want to have to create a code, or have to rename one by one, because that would be very laborious.
So my questions are:

1 - Is there any way to rename a FSM at run time or in the editor, or by action or code itself? Well, I searched, and found nothing until now.

2 - Because when I apply the template with a pre-defined name, the name does not appear in the FSM?

Example: assuming you have the FSM template "life", with the prefab name also life. But when I apply it to some empty FSM, the FSM receives all its properties (variables, actions ...) except the name of the FSM that should be Life.
And this is very bad because every time I have to add the FSM template to a new object, I have to change the name too. And the worst thing is that if someone puts a name that has capital letters, and I'm referring to this FSM in lowercase letters the playmaker does not understand, and so for example the send event does not work, and the debugger does not say why, because stop it, the two FSMs have the same name.

So who knows how to solve the first problem would help a lot, the second one is another complaint / suggestion, because I'm sure that many here suffer from it too.

Thank you very much





« Last Edit: April 10, 2018, 02:02:53 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

1: You can rename an Fsm, you can do this inside an action with:

this.Fsm.Name = "Hello";

But this will only remains while playing, when you stop playing, it will revert back

you can do this also in editor, you get to the PlaymakerFsm component using GetComponent() and then access it's fsm, or via PlayMaker api which can get you lists of fsms in the project, in the scene, etc.

2: Template do not set the Fsm name no. This is something I also would like to see implemented :)


Bye,

 Jean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Hi.
I made an action you can try, its in the attachment below.

Use "Get Name" or "Get Owner" to get the name of your object/prefab

Then use the action to set the name. if the target object has only 1 fsm you do not need to set the "Fsm Name" (leave it to none)

Let me know if it works.

btw in the editor window you won't always see that the name is changed, move to a different fsm and go back and you will see that it is changed.

Let me know how it goes :)

Stuksgens

  • Playmaker Newbie
  • *
  • Posts: 9
Hi,

1: You can rename an Fsm, you can do this inside an action with:

this.Fsm.Name = "Hello";

But this will only remains while playing, when you stop playing, it will revert back

you can do this also in editor, you get to the PlaymakerFsm component using GetComponent() and then access it's fsm, or via PlayMaker api which can get you lists of fsms in the project, in the scene, etc.


Thank you jean. apparently the get component solves this problem in the editor. not yet tested in Mobile for my phone died this week, but I think that will work at runtime.

so I test, I leave the topic as solved =)

Stuksgens

  • Playmaker Newbie
  • *
  • Posts: 9
Hi.
I made an action you can try, its in the attachment below.

Use "Get Name" or "Get Owner" to get the name of your object/prefab

Then use the action to set the name. if the target object has only 1 fsm you do not need to set the "Fsm Name" (leave it to none)

Let me know if it works.

btw in the editor window you won't always see that the name is changed, move to a different fsm and go back and you will see that it is changed.

Let me know how it goes :)


The above Jeanfabre already gave me an idea how to solve this problem, but thanks for helping me too. =)

Marc Saubion

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 79
Hi everyone.

I had the same issue working with templates that needed a specific FSM name. I used Jean's instructions to make the corresponding action attached below.

@jeanfabre , could you please add it to the ecosystem? I'd be happy to find it when I'll inevitably need it again. ^^

Thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 ok done, I added the reset method, it's important so that when the developer select reset int he action menu, it resets the variable back to default.

 Bye,

 Jean