playMaker

Author Topic: Singleton for newbie[SOLVED]  (Read 229 times)

amoraleite

  • Playmaker Newbie
  • *
  • Posts: 11
    • View Profile
Singleton for newbie[SOLVED]
« on: April 05, 2019, 03: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!
« Last Edit: April 08, 2019, 06:10:47 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14126
  • Official Playmaker Support
    • View Profile
Re: Singleton for newbie
« Reply #1 on: April 07, 2019, 11:04:11 PM »
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

amoraleite

  • Playmaker Newbie
  • *
  • Posts: 11
    • View Profile
Re: Singleton for newbie
« Reply #2 on: April 08, 2019, 04:30:36 AM »
Perfect Jean!


Ultra clear response!


Thank you very much! :D