UnityEngine.BitStream.Serialize C# (CSharp) Method

Serialize() public method

public Serialize ( NetworkPlayer &value ) : void
value NetworkPlayer
return void
        public void Serialize(ref NetworkPlayer value)
        {
            int index = value.index;
            this.Serializei(ref index);
            value.index = index;
        }

Same methods

BitStream::Serialize ( NetworkViewID &viewID ) : void
BitStream::Serialize ( Quaternion &value ) : void
BitStream::Serialize ( Quaternion &value, [ maxDelta ) : void
BitStream::Serialize ( Vector3 &value ) : void
BitStream::Serialize ( Vector3 &value, [ maxDelta ) : void
BitStream::Serialize ( bool &value ) : void
BitStream::Serialize ( char &value ) : void
BitStream::Serialize ( float &value ) : void
BitStream::Serialize ( float &value, [ maxDelta ) : void
BitStream::Serialize ( int &value ) : void
BitStream::Serialize ( short &value ) : void
BitStream::Serialize ( string &value ) : void

Usage Example

コード例 #1
0
    public int playerIndex = 0; // Player index of driver who spawned fake item box

    #endregion Fields

    #region Methods

    // Send data over network
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Vector3 position = Vector3.zero;
        Vector3 forwardVector = Vector3.zero;
        Vector3 upVector = Vector3.zero;
        if (stream.isWriting)
        {
            // Sending data...
            position = this.transform.position;
            forwardVector = this.transform.forward;
            upVector = this.transform.up;
            stream.Serialize(ref position);
            stream.Serialize(ref forwardVector);
            stream.Serialize(ref upVector);
            stream.Serialize(ref moveDirection);
            stream.Serialize(ref this.playerIndex);
        }
        else
        {
            // Receiving data...
            stream.Serialize(ref position);
            stream.Serialize(ref forwardVector);
            stream.Serialize(ref upVector);
            this.transform.position = position;
            this.transform.rotation = Quaternion.LookRotation(forwardVector, upVector);
            stream.Serialize(ref moveDirection);
            stream.Serialize(ref this.playerIndex);
        }
    }
All Usage Examples Of UnityEngine.BitStream::Serialize