mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
simplify OnSerialize
This commit is contained in:
parent
f77396b404
commit
90ee471bb8
@ -574,20 +574,10 @@ protected void SetSyncVar<T>(T value, ref T fieldValue, ulong dirtyBit)
|
||||
// note: SyncVar hooks are only called when inital=false
|
||||
public virtual bool OnSerialize(NetworkWriter writer, bool initialState)
|
||||
{
|
||||
bool objectWritten = false;
|
||||
// if initialState: write all SyncVars.
|
||||
// otherwise write dirtyBits+dirty SyncVars
|
||||
if (initialState)
|
||||
{
|
||||
objectWritten = SerializeObjectsAll(writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
objectWritten = SerializeObjectsDelta(writer);
|
||||
}
|
||||
|
||||
bool objectWritten = initialState ? SerializeObjectsAll(writer) : SerializeObjectsDelta(writer);
|
||||
bool syncVarWritten = SerializeSyncVars(writer, initialState);
|
||||
|
||||
return objectWritten || syncVarWritten;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user