I was wondering if there's functionality to have more than one user signed in at a time. Our game can have 8 local players, and it would be nice if players could login and access their own unlockable character customization options.
Best Answer
H
Hive Mind
said
over 7 years ago
In case anyone comes across this and is curious, here's what I did to make it work for multiple logins.
Since each GSInstance needs it's own Platform (otherwise each signin overrides the last), I modified PlatformBase.cs to store a GSInstance, which I set in each platform I make. Then I made sure in OnApplicationPaused and OnDestroy, I used this instance instead of the static one it used before.
The base C# SDK does support this, but you'll need to fiddle around a bit to get it to work in unity.
You can create multiple GSInstance instances, with each being logged in as a different player.
The standard GameSparksUnity object uses a static reference to GS (which is just a wrapper around a GSInstance.)
Have a look and see what you think, if you have question while trying this out feel free to hit us up!
Gabriel
H
Hive Mind
said
over 7 years ago
Will do, thanks!
H
Hive Mind
said
over 7 years ago
Answer
In case anyone comes across this and is curious, here's what I did to make it work for multiple logins.
Since each GSInstance needs it's own Platform (otherwise each signin overrides the last), I modified PlatformBase.cs to store a GSInstance, which I set in each platform I make. Then I made sure in OnApplicationPaused and OnDestroy, I used this instance instead of the static one it used before.
W
Will Garner
said
almost 7 years ago
I had the same requirement as Hive Mind and similarly modified PlatformBase. I see that when sending messages the various Request constructors have an overload that takes a GSInstance to use. Sending requests is essentially working with this technique - thanks!
But I wonder how to handle message listeners - I don't see how to associate a listener with a particular GSInstance such that each of my local players can handle their own messages. I see that the messages themselves have a gsInstance property. So presumably I could set up a global listener and dispatch the messages to each player "manually". But I'm hoping there's an easier way - analogous to passing the GSInstance to the equest constructors.
Hive Mind
I was wondering if there's functionality to have more than one user signed in at a time. Our game can have 8 local players, and it would be nice if players could login and access their own unlockable character customization options.
In case anyone comes across this and is curious, here's what I did to make it work for multiple logins.
Since each GSInstance needs it's own Platform (otherwise each signin overrides the last), I modified PlatformBase.cs to store a GSInstance, which I set in each platform I make. Then I made sure in OnApplicationPaused and OnDestroy, I used this instance instead of the static one it used before.
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
Hi There!
The base C# SDK does support this, but you'll need to fiddle around a bit to get it to work in unity.
You can create multiple GSInstance instances, with each being logged in as a different player.
The standard GameSparksUnity object uses a static reference to GS (which is just a wrapper around a GSInstance.)
Have a look and see what you think, if you have question while trying this out feel free to hit us up!
Gabriel
Hive Mind
Will do, thanks!
Hive Mind
In case anyone comes across this and is curious, here's what I did to make it work for multiple logins.
Since each GSInstance needs it's own Platform (otherwise each signin overrides the last), I modified PlatformBase.cs to store a GSInstance, which I set in each platform I make. Then I made sure in OnApplicationPaused and OnDestroy, I used this instance instead of the static one it used before.
Will Garner
I had the same requirement as Hive Mind and similarly modified PlatformBase. I see that when sending messages the various Request constructors have an overload that takes a GSInstance to use. Sending requests is essentially working with this technique - thanks!
But I wonder how to handle message listeners - I don't see how to associate a listener with a particular GSInstance such that each of my local players can handle their own messages. I see that the messages themselves have a gsInstance property. So presumably I could set up a global listener and dispatch the messages to each player "manually". But I'm hoping there's an easier way - analogous to passing the GSInstance to the equest constructors.
-
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