Skip to content

Commit ce75cf1

Browse files
committed
Fixed visibility API
1 parent 9abf209 commit ce75cf1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

MLAPI/MonoBehaviours/Core/NetworkedObject.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using MLAPI.Components;
55
using MLAPI.Data;
6+
using MLAPI.Internal;
67
using MLAPI.Logging;
78
using MLAPI.Serialization;
89
using UnityEngine;
@@ -167,7 +168,7 @@ public void NetworkShow(uint clientId, Stream payload = null)
167168
// Send spawn call
168169
observers.Add(clientId);
169170

170-
// TODO: Send show call
171+
SpawnManager.SendSpawnCallForObject(clientId, this, payload);
171172
}
172173
}
173174

@@ -188,7 +189,15 @@ public void NetworkHide(uint clientId)
188189
// Send destroy call
189190
observers.Remove(clientId);
190191

191-
// TODO: Send hide call
192+
using (PooledBitStream stream = PooledBitStream.Get())
193+
{
194+
using (PooledBitWriter writer = PooledBitWriter.Get(stream))
195+
{
196+
writer.WriteUInt64Packed(NetworkId);
197+
198+
InternalMessageHandler.Send(MLAPIConstants.MLAPI_DESTROY_OBJECT, "MLAPI_INTERNAL", stream, SecuritySendFlags.None, null);
199+
}
200+
}
192201
}
193202
}
194203

0 commit comments

Comments
 (0)