Sign In Register

How can we help you today?

Start a new topic
Answered

Unity - GameSparksUnity script on loading same scene again

 Hi,


I have a question in regards to GameSparksUnity instances: My unity3d game has one main menu and several game scenes which all come back to the menu scene once a game finishes. In the main menu I have a GameObject with the GameSparksUnity script attached and I am observing log output that everytime I am returning to the menu scene the connection to GameSparks is reestablished. What is a pattern/best practice around this?


Best Regards,

Thomas


Best Answer

Hi Thomas,


If you put the GameObject with the GameSparksUnity Script into a scene before your Main Menu (such as a loading screen) you will be able to avoid this behavior when returning to your Main Menu after a game. The way you have it setup at the moment a new instance of the GameObject with the GameSparksUnity script is created every time you go back to the Main Menu.


Thanks,

Liam

1 Comment

Answer

Hi Thomas,


If you put the GameObject with the GameSparksUnity Script into a scene before your Main Menu (such as a loading screen) you will be able to avoid this behavior when returning to your Main Menu after a game. The way you have it setup at the moment a new instance of the GameObject with the GameSparksUnity script is created every time you go back to the Main Menu.


Thanks,

Liam

Login to post a comment