playMaker

Author Topic: So FSM templates are NOT instantiated...  (Read 218 times)

PolyMad

  • Sr. Member
  • ****
  • Posts: 497
    • View Profile
So FSM templates are NOT instantiated...
« on: September 12, 2021, 06:25:38 AM »
I thought up to now that the FSM templates were instantiated for each object using them, but they are not.
Now I understand why some behaviors were strange.

Is there a way to have this, I mean: exactly the same FSM for many prefabs, that gets instantiated with each of them at spawn in the scene?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 6395
    • View Profile
    • jinxtergames
Re: So FSM templates are NOT instantiated...
« Reply #1 on: September 12, 2021, 06:48:08 AM »
Hi.
I use many templates in our game, some directly and many in Run FSM actions.

But i did not notice any issues. (it is Playmaker 1.9.0 tho not yet newer version)

Can you show what issues you have and what playmaker version you are using?
Ecosystem might not work at the moment
here are direct Github Links to the custom actions :
https://github.com/PlayMakerEcosystem
https://github.com/jeanfabre


Join the PlayMaker Discord Channel!

PolyMad

  • Sr. Member
  • ****
  • Posts: 497
    • View Profile
Re: So FSM templates are NOT instantiated...
« Reply #2 on: September 12, 2021, 07:32:07 AM »

As you can see, the logs all grow the same size.
If you see sharply, the first log starts small and then grows, but the next ones start already large. That's because the FSM is the same and not instantiated on the different prefabs asyncronously: it's exactly the same.
If the FSM was instantiated, they should grow each one with its own size: small at spawn, and then grow.

I tried this over and over with different actions.
In this case, I made the scaling myself, using the Scale Object, but also using Tween I have the same result.
Apparently, the same FSM is managing all the logs, and thus a single Scale variable is used for all of them.

I must say that I COPIED the Unity Object and pasted it to several different objects, so I don't know if this can be the issue, as Unity would assign the exact same identifier to all of them. Not sure about how this works.
« Last Edit: September 12, 2021, 07:59:12 AM by PolyMad »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 6395
    • View Profile
    • jinxtergames
Re: So FSM templates are NOT instantiated...
« Reply #3 on: September 14, 2021, 07:47:23 AM »
Hi.
I did a quick test on my end.


maybe you can show your setup, maybe something wrong there.
Ecosystem might not work at the moment
here are direct Github Links to the custom actions :
https://github.com/PlayMakerEcosystem
https://github.com/jeanfabre


Join the PlayMaker Discord Channel!

PolyMad

  • Sr. Member
  • ****
  • Posts: 497
    • View Profile
Re: So FSM templates are NOT instantiated...
« Reply #4 on: September 14, 2021, 10:10:49 AM »
There is something REALLY fishy going on here.
I was recording a video for you (btw: thank you very much for all your time, one day I'm sure I will be able to pay back), and re-adapting the scripts because meanwhile I changed the concept of my game, so the TapManager has completely changed.

So I have put back the old template to the camera to make it work.
And of course the situation was exactly the same as before.
Then I worked on the log to be spawned, because I wanted to show you both my manual scaling and the Tween solution too.

And... now the Tween solution WORKS, but when using my manual scaling, still the FSM doesn't look instantiated: all the logs seem to be using the same Scale variable.

OMG now I uncovered the problem... while I was recording the video... and there is in fact something very fishy going on... or I am terribly dumb?


PolyMad

  • Sr. Member
  • ****
  • Posts: 497
    • View Profile
Re: So FSM templates are NOT instantiated...
« Reply #5 on: September 14, 2021, 10:20:36 AM »
However, the thing seems to work with Tween, so for now I'll stick with that... but something is wrong in my opinion.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 6395
    • View Profile
    • jinxtergames
Re: So FSM templates are NOT instantiated...
« Reply #6 on: September 14, 2021, 11:52:21 AM »
Hi.
i think some this is wrong with the way you spawn them.

On the video at 2:37 on the Hierarchy i can see that you are creating a clone from the clone from the clone.

Which explains why it spawns to the same size.
Ecosystem might not work at the moment
here are direct Github Links to the custom actions :
https://github.com/PlayMakerEcosystem
https://github.com/jeanfabre


Join the PlayMaker Discord Channel!

PolyMad

  • Sr. Member
  • ****
  • Posts: 497
    • View Profile
Re: So FSM templates are NOT instantiated...
« Reply #7 on: September 14, 2021, 01:00:50 PM »
Dohhhh thank you man!!!