NeuroGoblin
NeuroGoblin
NNormal
Created by NeuroGoblin on 5/22/2024 in #🤝ask-a-question
Realtime OnChanged event will not fire
No description
44 replies
NNormal
Created by NeuroGoblin on 5/8/2024 in #🤝ask-a-question
Unity Crashing ~10 seconds after loading realtime with a certain name.
Hey guys, Having a rather strange issue. Recently all of our developers started reporting crashes about ~10 sec after a scene with Realtime in it loads (it connects on start). The room name is 'Cyboracle_Persistent'. - When changing the room name to anything else, even 'Cyboracle_Persistent2', it works fine. I disabled all other gameobjects other than the realtime room gameobject. - When making a new scene in the same project, importing the cube example and setting the room to 'Cyboracle_Persistent', it crashes. - When changing the room in the above test scene to anything else, it works fine. - When starting a brand new project, importing normcore and the cube player, and setting the room to 'Cyboracle_Persistent', it works fine. (same app key) So the issue seems to be isolated to this particular room string, in this particular project. I'm happy to just use a different string, but I'm nervous that the same thing would eventually happen with that string in production. At various times there have been other devs connecting to that room, but in this instance it should just join the pre-existing room if i'm not mistaken. Given that I disabled basically everything in the original project except the realtime, i'm not sure what the difference between the projects is. Cached stuff? Build settings? We are using WebGL on Unity 2022.2.19f1. Let me know if you need any more info! Thanks in advance 🙂
35 replies
NNormal
Created by NeuroGoblin on 4/17/2024 in #🤝ask-a-question
Re-subscribing to delegate events on scene change
Hey yall, my app systemetically changes the scene of all clients in a given order. The first time this happens (from scene A->B) it works great. However, after that (B->C etc), my delegate event (IsSceneChangingDidChange) does not fire. I can also see that the OnRealtimeModelReplaced() method does not run again. I'm not sure how to manually resubscribe to this delegate to listen for model changes when a new scene is loaded. My RealtimeView component this script is attached to is persistent and a singleton. Here is the method in question: protected override void OnRealtimeModelReplaced(SceneSyncModel previousModel, SceneSyncModel currentModel) { if (previousModel != null) { // Unregister from events previousModel.isSceneChangingDidChange -= IsSceneChangingDidChange; } if (currentModel != null) { if (currentModel.isFreshModel) { currentModel.nextScene = nextScene; } // Set local variables based on model nextScene = model.nextScene; currentModel.isSceneChangingDidChange += IsSceneChangingDidChange; } } Thanks in advance!
23 replies
NNormal
Created by NeuroGoblin on 4/17/2024 in #🤝ask-a-question
Suddenly unable to connect to Normcore servers
No description
39 replies
NNormal
Created by NeuroGoblin on 4/16/2024 in #🤝ask-a-question
What's the best way to change scenes across all clients?
Hi guys! As per the title, my application requires that all users be in a certain room at a certain time. I don't seem to be able to trigger this accross a second client (webXR build), only my local machine. This is my SceneSyncModel: [RealtimeModel] public partial class SceneSyncModel { [RealtimeProperty(1, true, true)] private string _currentScene; [RealtimeProperty(2, true, true)] private string _nextScene; [RealtimeProperty(3, true, true)] private bool _isSceneChanging; } On load, I locally set the nextScene string: public string nextScene; void Awake() { nextScene = SceneManager.GetActiveScene().name == "Admin" ? "LobbyNetworkTest" : "Admin"; } Then, once the realtime room has connected, I call SetNextScene(), which updates the model: public void SetNextScene() { model.nextScene = nextScene; // local reference as above } Then, when ready, I set the changing bool to true: public void SetIsSceneChanging(bool isChanging) { model.isSceneChanging = isChanging; } which then successfully fires a delegate: private void IsSceneChangingDidChange(SceneSyncModel model, bool isChanging) { // if true, trigger scene switch if (isChanging) { // Set bool to false so that on next scene load it is in the correct state SetIsSceneChanging(false); Debug.Log("IsChanging was true, switching to " + model.nextScene); SceneManager.LoadScene(model.nextScene); } else { Debug.Log("IsChanging was false, didn't switch"); } } This works locally, but doesn't seem to trigger the scene change on my other client. Please let me know if you need any more info!
32 replies
NNormal
Created by NeuroGoblin on 4/15/2024 in #🤝ask-a-question
How to make a custom model using a type other than Color?
No description
10 replies