This commit is contained in:
vis2k 2021-03-09 11:18:15 +08:00
parent 2be35efbad
commit c2af82f897

View File

@ -179,30 +179,20 @@ public NetworkVisibility visibility
[SerializeField, HideInInspector] string m_AssetId; [SerializeField, HideInInspector] string m_AssetId;
/// <summary> /// <summary>Prefab GUID used to spawn prefabs across the network.</summary>
/// Unique identifier used to find the source assets when server spawns the on clients. //
/// </summary> // The AssetId trick:
/// <remarks> // Ideally we would have a serialized 'Guid m_AssetId' but Unity can't
/// <list type="bullet"> // serialize it because Guid's internal bytes are private
/// <listheader><description> //
/// The AssetId trick: // UNET used 'NetworkHash128' originally, with byte0, ..., byte16
/// </description></listheader> // which works, but it just unnecessary extra code
/// <item><description> //
/// Ideally we would have a serialized 'Guid m_AssetId' but Unity can't // Using just the Guid string would work, but it's 32 chars long and
/// serialize it because Guid's internal bytes are private // would then be sent over the network as 64 instead of 16 bytes
/// </description></item> //
/// <item><description> // => The solution is to serialize the string internally here and then
/// UNET used 'NetworkHash128' originally, with byte0, ..., byte16 // use the real 'Guid' type for everything else via .assetId
/// which works, but it just unnecessary extra code
/// </description></item>
/// <item><description>
/// 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
/// </description></item>
/// </list>
/// The solution is to serialize the string internally here and then
/// use the real 'Guid' type for everything else via .assetId
/// </remarks>
public Guid assetId public Guid assetId
{ {
get get