Implement multiplayer scene loading
This commit is contained in:
@@ -65,6 +65,8 @@ public class PlayerComponent : NetworkBehaviour
|
||||
|
||||
private void Start()
|
||||
{
|
||||
StartCoroutine(AddDontDestroyToDependencies());
|
||||
|
||||
if (!isSoloRig) return;
|
||||
|
||||
audioListener.enabled = true;
|
||||
@@ -108,6 +110,16 @@ public class PlayerComponent : NetworkBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator AddDontDestroyToDependencies()
|
||||
{
|
||||
yield return new WaitForEndOfFrame();
|
||||
|
||||
foreach (var d in dependencies)
|
||||
{
|
||||
DontDestroyOnLoad(d);
|
||||
}
|
||||
}
|
||||
|
||||
public void DestroyDependencies()
|
||||
{
|
||||
foreach (var d in dependencies)
|
||||
@@ -121,7 +133,7 @@ public class PlayerComponent : NetworkBehaviour
|
||||
public void Toggle(bool active)
|
||||
{
|
||||
// Only toggle solo rig components, not multiplayer one
|
||||
if (isSoloRig)
|
||||
if (networkObject == null || isSoloRig)
|
||||
{
|
||||
foreach (var d in dependencies)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user