Description
Not sure if this is a bug or a feature request.
For context, my game features a play session that you can start offline and then later share online if you want to. I'm using enableSceneManagement=false.
NetworkObjects instantiated prior to calling NetworkManager.StartHost() used to count as in-scene-placed netObjs before NGO 2.13. This means that starting the server would automatically spawn these objects. With the recent update however, this is no longer true. You now have to manually spawn these netObjs. That's fine, I can work with that.
The problem is that netObjs that have been parented prior to starting the server no longer retains their parent-child relationship. This is a bit more problematic for my game.
Reproduce Steps
internal class InScenePlacedObjectsTests : NetcodeIntegrationTest {
protected override int NumberOfClients => 0;
NetworkObject prefab;
protected override bool CanStartServerAndClients() {
return false;
}
protected override void OnServerAndClientsCreated() {
base.OnServerAndClientsCreated();
prefab = NetcodeIntegrationTestHelpers.CreateNetworkObjectPrefab(
"prefab",
m_ServerNetworkManager
).GetComponent<NetworkObject>();
m_ServerNetworkManager.NetworkConfig.PlayerPrefab = null;
m_ServerNetworkManager.NetworkConfig.EnableSceneManagement = false;
m_ServerNetworkManager.LogLevel = LogLevel.Developer;
}
[UnityTest]
public IEnumerator SceneManagementOffSpawningAfter() {
var parent = Object.Instantiate(prefab).GetComponent<NetworkObject>();
var child = Object.Instantiate(prefab, parent.gameObject.transform).GetComponent<NetworkObject>();
m_ServerNetworkManager.StartHost();
yield return null;
#if NGO_2_13_OR_NEWER //custom preprocessor that just checks for ngo version
parent.Spawn();
child.Spawn();
yield return null;
#else
Assert.IsTrue(parent.IsSpawned && parent.IsSceneObject == true);
Assert.IsTrue(child.IsSpawned && child.IsSceneObject == true);
#endif
//NetworkObject.CurrentParent is null even if NetworkObject.SetSceneObjectStatus(true) is called prior to spawning/starting network session
Assert.IsTrue(child.transform.parent == parent.transform);
yield return null;
}
protected override IEnumerator OnTearDown() {
Object.DestroyImmediate(prefab.gameObject);
return base.OnTearDown();
}
}
Outcome
The test works in NGO 2.12, but fails in 2.13
Environment
- Unity Version: 6000.3.16f1
- Netcode Version: 2.13
- Netcode Topology: Client-Server
Additional Context
I guess I'm looking for a feature/bug fix that can support my use case.
I thought about using SinglePlayerTransport, but if I have to share the play session online, I would presumably have to shutdown the server, which would destroy all my NetworkObjects, and reconnect using the real transport. I want to avoid having to go back to the main menu and start the play session as an online-session.
Description
Not sure if this is a bug or a feature request.
For context, my game features a play session that you can start offline and then later share online if you want to. I'm using
enableSceneManagement=false.NetworkObjects instantiated prior to calling
NetworkManager.StartHost()used to count as in-scene-placed netObjs before NGO 2.13. This means that starting the server would automatically spawn these objects. With the recent update however, this is no longer true. You now have to manually spawn these netObjs. That's fine, I can work with that.The problem is that netObjs that have been parented prior to starting the server no longer retains their parent-child relationship. This is a bit more problematic for my game.
Reproduce Steps
Outcome
The test works in NGO 2.12, but fails in 2.13
Environment
Additional Context
I guess I'm looking for a feature/bug fix that can support my use case.
I thought about using
SinglePlayerTransport, but if I have to share the play session online, I would presumably have to shutdown the server, which would destroy all my NetworkObjects, and reconnect using the real transport. I want to avoid having to go back to the main menu and start the play session as an online-session.