Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: amoraleite on April 05, 2019, 06:13:31 PM

Title: Singleton for newbie[SOLVED]
Post by: amoraleite on April 05, 2019, 06:13:31 PM
Hi Guys!

How to exact can I use this action?

I see that works with string? But where exactly I place the action... And who's can call the var string?

I have a script that I need don't destroy. So I put the "don't destroy on load" in this object works well, but when I load the new scene I have a duplicate object.
By reading I learned that the singleton worked for this ... but how?

Thank you guys!
Title: Re: Singleton for newbie
Post by: jeanfabre on April 08, 2019, 02:04:11 AM
Hi,

 you put this action on the object you don't want to destroy and be unique in your scene. so if you have two scenes, both object on both scenes needs that singleton action with the same reference. then only one will exists no matter what.

 the name is a reference, if there is two objects with the same reference assigned, then only one survive ( the older)

 Bye,

 Jean
Title: Re: Singleton for newbie
Post by: amoraleite on April 08, 2019, 07:30:36 AM
Perfect Jean!


Ultra clear response!


Thank you very much! :D