In what circumstances does EndSessionRequest get sent automatically by the GamesparksUnity script? How do I prevent that from happening?
In the game I am trying to implement Gamesparks I have three scenes. The first scene is the main menu, the second scene is the actual game, the final scene is the game over menu. The gamesparks script is attached to my main game manager component which has my game manager script implemented as a singleton. When the game over scene is presented there is a button that loads the game scene again to replay and a button that loads the main menu scene. When I choose to replay the game everything works fine. When I choose to go to the main menu Gamesparks sends a EndSessionRequest and ends the gamesparks session. I know I could hack together something to just reauthenticate on the main menu but I would strongly prefer it just work properly and not automatically send the EndSessionRequest.
Best Answer
C
Craig Amundson
said
over 6 years ago
I found the cause of the problem. My singleton was setup to delete the newly created game object in the Start() method instead of the Awake() method. Moving the singleton code to the Awake() method fixed the issue. Thank you for your response!
Is it possible that when you go back to the main menu, you end up with two game-managers in the same scene? One from the scene and one brought into it from the persistent game-manager object that followed you through the game-scenes? If this is the case then you would need to get your singleton to check for any other game-managers in the scene when a new scene loads, and remove it. This could be cause the EndSessionRequest to be called as the other game-manager launches a second SDK.
Another possibility is if you pause or suspend the game when loading the main-menu scene? which would also call an EndSessionRequest.
If you can let me know if you see any of this behavior.
Thanks, Sean
C
Craig Amundson
said
over 6 years ago
Answer
I found the cause of the problem. My singleton was setup to delete the newly created game object in the Start() method instead of the Awake() method. Moving the singleton code to the Awake() method fixed the issue. Thank you for your response!
Craig Amundson
In what circumstances does EndSessionRequest get sent automatically by the GamesparksUnity script? How do I prevent that from happening?
In the game I am trying to implement Gamesparks I have three scenes. The first scene is the main menu, the second scene is the actual game, the final scene is the game over menu. The gamesparks script is attached to my main game manager component which has my game manager script implemented as a singleton. When the game over scene is presented there is a button that loads the game scene again to replay and a button that loads the main menu scene. When I choose to replay the game everything works fine. When I choose to go to the main menu Gamesparks sends a EndSessionRequest and ends the gamesparks session. I know I could hack together something to just reauthenticate on the main menu but I would strongly prefer it just work properly and not automatically send the EndSessionRequest.
I found the cause of the problem. My singleton was setup to delete the newly created game object in the Start() method instead of the Awake() method. Moving the singleton code to the Awake() method fixed the issue. Thank you for your response!
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Is it possible that when you go back to the main menu, you end up with two game-managers in the same scene? One from the scene and one brought into it from the persistent game-manager object that followed you through the game-scenes?
If this is the case then you would need to get your singleton to check for any other game-managers in the scene when a new scene loads, and remove it.
This could be cause the EndSessionRequest to be called as the other game-manager launches a second SDK.
Another possibility is if you pause or suspend the game when loading the main-menu scene? which would also call an EndSessionRequest.
If you can let me know if you see any of this behavior.
Thanks,
Sean
Craig Amundson
I found the cause of the problem. My singleton was setup to delete the newly created game object in the Start() method instead of the Awake() method. Moving the singleton code to the Awake() method fixed the issue. Thank you for your response!
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics