File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
MLAPI/MonoBehaviours/Core Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -124,23 +124,26 @@ public bool isSpawned
124
124
125
125
private void OnDestroy ( )
126
126
{
127
- SpawnManager . OnDestroyObject ( NetworkId , false ) ;
127
+ if ( NetworkingManager . singleton != null )
128
+ SpawnManager . OnDestroyObject ( NetworkId , false ) ;
128
129
}
129
130
130
131
/// <summary>
131
132
/// Spawns this GameObject across the network. Can only be called from the Server
132
133
/// </summary>
133
134
public void Spawn ( )
134
135
{
135
- SpawnManager . OnSpawnObject ( this ) ;
136
+ if ( NetworkingManager . singleton != null )
137
+ SpawnManager . OnSpawnObject ( this ) ;
136
138
}
137
139
/// <summary>
138
140
/// Spawns an object across the network with a given owner. Can only be called from server
139
141
/// </summary>
140
142
/// <param name="clientId">The clientId to own the object</param>
141
143
public void SpawnWithOwnership ( int clientId )
142
144
{
143
- SpawnManager . OnSpawnObject ( this , clientId ) ;
145
+ if ( NetworkingManager . singleton != null )
146
+ SpawnManager . OnSpawnObject ( this , clientId ) ;
144
147
}
145
148
/// <summary>
146
149
/// Removes all ownership of an object from any client. Can only be called from server
You can’t perform that action at this time.
0 commit comments