playMaker

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

amoraleite

  • Playmaker Newbie
  • *
  • Posts: 17
Singleton for newbie[SOLVED]
« 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!
« Last Edit: April 08, 2019, 09:10:47 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Singleton for newbie
« Reply #1 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

amoraleite

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


Ultra clear response!


Thank you very much! :D