public void Write(BitStream stream, string name, object[] parameters) { if (ParameterWriter.CanPrepare(parameters)) { ParameterWriter writer; if (_writers.TryGetValue(name, out writer) && writer.IsPreparedFor(parameters)) { writer.WritePrepared(stream, parameters); return; } writer = new ParameterWriter(parameters); writer.WritePrepared(stream, parameters); _writers[name] = writer; } else { ParameterWriter.WriteUnprepared(stream, parameters); } }
/// <summary> /// Sets the initial data for this network aware object. /// </summary> /// <remarks>Only use this function if you are working with custom allocation of viewIDs and needs to set /// the initial data for a network aware object. Normally, the initial data can be specified in the call to /// one of the /// <see cref="O:uLink.Network.Instantiate"/> /// functions. Never use this function unless /// you know what you are doing and you are working with custom allocation of viewIDs at runtime /// (<see cref="O:uLink.Network.AllocateViewID"/>). /// </remarks> public void SetInitialData(params object[] args) { initialData = new BitStream(false); ParameterWriter.WriteUnprepared(initialData, args); }