Easy Save with Normcore Realtime
Posted: Mon Apr 19, 2021 6:37 pm
Not sure if anyone has experience with Normcore for multiplayer. I'm loading saved prefabs into a scene that is using Normcore for multiplayer. Normcore uses a "Realtime" component to keep track of items to be synced across the network. It is possible to have multiple Realtimes in a scene.
When you instantiate a prefab you have to let Normcore know which Realtime you are instantiating the prefab into. I have modified the code in the ES3Prefab and it worked fine with only one Realtime in the scene. Now that I have to have 2 Realtimes in the scene, I'm not sure how to pass a reference of which Realtime I want to use to ES3Prefab.
this is the line I'm modifying to make it work with Normcore. The problem is the "es3Prefab._realtimeInstance". This was my hack to try and get the prefab to instantiate into the proper Realtime instance. It does not work.
If anyone is familiar with this I would truly appreciate any insight.
When you instantiate a prefab you have to let Normcore know which Realtime you are instantiating the prefab into. I have modified the code in the ES3Prefab and it worked fine with only one Realtime in the scene. Now that I have to have 2 Realtimes in the scene, I'm not sure how to pass a reference of which Realtime I want to use to ES3Prefab.
Code: Select all
var instance = Application.isPlaying ? Realtime.Instantiate(es3Prefab.gameObject.name, es3Prefab.gameObject.transform.position, es3Prefab.gameObject.transform.rotation, true, false, true, es3Prefab._realtimeInstance) : PrefabUtility.InstantiatePrefab(es3Prefab.gameObject);
this is the line I'm modifying to make it work with Normcore. The problem is the "es3Prefab._realtimeInstance". This was my hack to try and get the prefab to instantiate into the proper Realtime instance. It does not work.
If anyone is familiar with this I would truly appreciate any insight.