NetworkIdentity

This commit is contained in:
Chris Langsenkamp 2019-08-01 02:08:11 -04:00
parent 30afb60eca
commit c23b0b89c4

View File

@ -140,19 +140,17 @@ public bool isServer
[SerializeField] string m_AssetId; [SerializeField] string m_AssetId;
// the AssetId trick:
// - ideally we would have a serialized 'Guid m_AssetId' but Unity can't
// serialize it because Guid's internal bytes are private
// - UNET used 'NetworkHash128' originally, with byte0, ..., byte16
// which works, but it just unnecessary extra code
// - using just the Guid string would work, but it's 32 chars long and
// would then be sent over the network as 64 instead of 16 bytes
// -> the solution is to serialize the string internally here and then
// use the real 'Guid' type for everything else via .assetId
/// <summary> /// <summary>
/// Unique identifier used to find the source assets when server spawns the on clients. /// Unique identifier used to find the source assets when server spawns the on clients.
/// <para>
/// the AssetId trick:
/// - ideally we would have a serialized 'Guid m_AssetId' but Unity can't
/// serialize it because Guid's internal bytes are private
/// - UNET used 'NetworkHash128' originally, with byte0, ..., byte16
/// which works, but it just unnecessary extra code
/// - using just the Guid string would work, but it's 32 chars long and
/// would then be sent over the network as 64 instead of 16 bytes
/// -> the solution is to serialize the string internally here and then
/// use the real 'Guid' type for everything else via .assetId
/// </para>
/// </summary> /// </summary>
public Guid assetId public Guid assetId
{ {