@@ -639,10 +639,12 @@ private void InternalOnOneTimeSetup()
639639 /// <returns><see cref="IEnumerator"/></returns>
640640 protected virtual IEnumerator OnSetup ( )
641641 {
642- if ( m_allPrefabsAsHybrid )
642+ #if UNIFIED_NETCODE
643+ if ( m_AllPrefabsAsHybrid )
643644 {
644645 NetworkSpawnManager . RegisterPendingGhost = RegisterPendingGhost ;
645646 }
647+ #endif
646648 yield return null ;
647649 }
648650
@@ -656,10 +658,12 @@ protected virtual IEnumerator OnSetup()
656658 /// </summary>
657659 protected virtual void OnInlineSetup ( )
658660 {
659- if ( m_allPrefabsAsHybrid )
661+ #if UNIFIED_NETCODE
662+ if ( m_AllPrefabsAsHybrid )
660663 {
661664 NetworkSpawnManager . RegisterPendingGhost = RegisterPendingGhost ;
662665 }
666+ #endif
663667 }
664668
665669 /// <summary>
@@ -726,6 +730,7 @@ public IEnumerator SetUp()
726730 VerboseDebug ( $ "Exiting { nameof ( SetUp ) } ") ;
727731 }
728732
733+ #if UNIFIED_NETCODE
729734 private void RegisterPendingGhost ( NetworkObject networkObject , ulong networkObjectId )
730735 {
731736 var ghost = networkObject . GetComponent < GhostAdapter > ( ) ;
@@ -741,6 +746,7 @@ private void RegisterPendingGhost(NetworkObject networkObject, ulong networkObje
741746 }
742747 Debug . LogError ( $ "Did not find a world for NetworkObject-{ networkObjectId } !!") ;
743748 }
749+ #endif
744750
745751 /// <summary>
746752 /// Override this to add components or adjustments to the default player prefab
@@ -1653,7 +1659,7 @@ protected IEnumerator CoroutineShutdownAndCleanUp()
16531659 protected void UnifiedCleanup ( )
16541660 {
16551661#if UNIFIED_NETCODE
1656- if ( m_allPrefabsAsHybrid )
1662+ if ( m_AllPrefabsAsHybrid )
16571663 {
16581664 NetworkSpawnManager . RegisterPendingGhost = null ;
16591665 CleanupPrefabReferences ( ) ;
@@ -1818,13 +1824,17 @@ protected void DestroySceneNetworkObjects()
18181824 // and then destroying the ghostAdapter prior to destroying
18191825 // a hybrid prefab.
18201826 var ghostAdapter = networkObject . GetComponent < GhostAdapter > ( ) ;
1821- if ( ghostAdapter != null && ghostAdapter . prefabReference != null )
1827+ if ( ghostAdapter != null )
18221828 {
1823- var prefabReference = ghostAdapter . prefabReference ;
1824- prefabReference . Prefab = null ;
1825- ghostAdapter . prefabReference = null ;
1826- Object . Destroy ( prefabReference ) ;
1827- Object . Destroy ( ghostAdapter ) ;
1829+ if ( ghostAdapter . prefabReference != null )
1830+ {
1831+ var prefabReference = ghostAdapter . prefabReference ;
1832+ prefabReference . Prefab = null ;
1833+ ghostAdapter . prefabReference = null ;
1834+ Object . Destroy ( prefabReference ) ;
1835+ }
1836+ Object . Destroy ( networkObject . gameObject ) ;
1837+ continue ;
18281838 }
18291839#endif
18301840 // Destroy the GameObject that holds the NetworkObject component
@@ -2254,7 +2264,7 @@ internal void WaitForMessagesReceivedWithTimeTravel(List<Type> messagesInOrder,
22542264 }
22552265
22562266#if UNIFIED_NETCODE
2257- protected bool m_allPrefabsAsHybrid = false ;
2267+ protected bool m_AllPrefabsAsHybrid = false ;
22582268#endif
22592269
22602270 /// <summary>
@@ -2267,7 +2277,7 @@ internal void WaitForMessagesReceivedWithTimeTravel(List<Type> messagesInOrder,
22672277 protected GameObject CreateNetworkObjectPrefab ( string baseName )
22682278 {
22692279#if UNIFIED_NETCODE
2270- if ( m_allPrefabsAsHybrid )
2280+ if ( m_AllPrefabsAsHybrid )
22712281 {
22722282 return CreateHybridPrefab ( baseName ) ;
22732283 }
@@ -2585,7 +2595,7 @@ private void InitializeTestConfiguration(NetworkTopologyTypes networkTopologyTyp
25852595 }
25862596#if UNIFIED_NETCODE
25872597 m_UseHost = hostOrServer == HostOrServer . Host || hostOrServer == HostOrServer . DAHost || hostOrServer == HostOrServer . UnifiedHost ;
2588- m_allPrefabsAsHybrid = ( hostOrServer == HostOrServer . UnifiedServer || hostOrServer == HostOrServer . UnifiedHost ) ;
2598+ m_AllPrefabsAsHybrid = ( hostOrServer == HostOrServer . UnifiedServer || hostOrServer == HostOrServer . UnifiedHost ) ;
25892599#else
25902600 m_UseHost = hostOrServer == HostOrServer . Host || hostOrServer == HostOrServer . DAHost ;
25912601#endif
0 commit comments