On switching sessions after connected to a session already with objects, objects from switched to Session do not show up. Using AutoJoinSession to switch sessions. After a session is entered with objects, no objects works, but if you are in a session with created objects and then you switch to another session the objects in the switched to session do not show up.
I'm a little confused on your explanation. Which objects and what kind of objects were they?
Did you also make sure to keep the room alive when leaving and re-entering?
Also, did you try my latest PR for sharing service updates?
So I enter a session that objects were spawned in by other users in the session (spawned objects load fine).
When I switch to another session that is open with different other users with spawned objects the spawned objects do not show up. They do if I join either first.
What am I doing wrong, rooms?
Also do different rooms in the same session have different objects because they didn't seem to? Changing rooms didn't seem to do anything.
So I am using this code inside the AutoJoinSession.cs to switch Sessions (works until after the fist time there are spawned objects in a session):
sessionsTracker.LeaveCurrentSession();
sessionsTracker.JoinSession(session);
// This is a ServerSessionsTracker, not sure if LeaveCurrentSession is needed
Using this code to spawn objects in a session (works):
SyncSpawnedObject spawnedObject = new SyncSpawnedObject();
mySpawnManager.Spawn(spawnedObject, position, rotation, mySpawnParent, "SpawnedObject", false);
//This is a PrefabSpawnManager in the project
`
No I haven't tried yours but I will, fixes?
This could be a combination of a few things:
PR https://github.com/Microsoft/HoloToolkit-Unity/pull/513 added a few nice things for easier/faster testing in editor.
So are the spawned objects connected to a session or a room? Because changing the room seemed to do nothing to the objects. Thanks for your help btw.
No worries. Pretty sure that it depends on your setup and how you're doing the sync object spawning. They attach themselves to the root object of the room.
Thanks, Hmmm, I must be missing something as switching rooms does nothing but sessions does. And there is pretty much no explanation from Microsoft. The code in the videos is old and has changed.
What is the proper way to setup a room and switch? Thanks.
Good question. I think the Room and Anchor test scene is good, but only works in the editor, but doesn't also show synced objects. A bunch of this stuff has been on my todo list to make a bit better.
I kind of got the idea that the rooms were just for the anchor position if people were in different rooms and that the objects were attached to the session. That's what I got from reading the descriptions in GitHub repeatedly.
Yeah that sounds correct.
In either case the synced objects _should_ persist if the room is kept alive.
As for sessions, I'm not so sure. Hopefully someone will come along and clarify.
(most likely sessions do not preserve synced objects)
The sessions seem to if the session is kept alive. It's just the switching from one with objects to the other with objects that isn't.
Would you know if there is a way I can attach a String or Bool Value on a session/room?
No you can only create new sync variables on the sync root object.
Hmmmm maybe the sync root is what I need to reset when switching sessions.
- Ownership
- Each element has an 'owner'
- Owner is either user in the session or the Invalid user, which is used to represent unowned elements
- When a system leaves a session
- The server removes elements owned by the user that left, forward changes to remaining systems
- The system that left deletes all elements except his/her own and global data
Not sure if this helps but there is some buried documentation in the external folders.
Check out https://github.com/Microsoft/HoloToolkit/pull/42.
It seems to address the persistent session data functionality you're looking for.
Looks like the work on it kinda died down a while ago though.
Going to close this. I did push a update to recreate synced objects if needed.