static UnityGUID() { MissingReference = new UnityGUID(); MissingReference.m_data[0] = 0xD0000000; MissingReference.m_data[1] = 0x5DEADF00; MissingReference.m_data[2] = 0xEADBEEF1; MissingReference.m_data[3] = 0x0000000D; }
public BuildSettings(AssetInfo assetInfo) : base(assetInfo) { if (IsReadBuildTags) { BuildGUID = new UnityGUID(); } }
protected Object(AssetInfo assetInfo) { if (assetInfo == null) { throw new ArgumentNullException(nameof(assetInfo)); } m_assetInfo = assetInfo; if (assetInfo.ClassMap.IDType != ClassID) { throw new ArgumentException($"Try to initialize '{ClassID}' with '{assetInfo.ClassMap.IDType}' asset data", nameof(assetInfo)); } if (IsAsset) { GUID = new UnityGUID(Guid.NewGuid()); } }
private void CalculatePrefabHash() { List <uint> hashList = new List <uint>(); foreach (Object @object in FetchObjects()) { hashList.AddRange(@object.GUID.Data); } uint[] hashArray = hashList.ToArray(); byte[] buffer = new byte[hashArray.Length * sizeof(uint)]; Buffer.BlockCopy(hashArray, 0, buffer, 0, buffer.Length); using (MD5 md5 = MD5.Create()) { byte[] hash = md5.ComputeHash(buffer); GUID = new UnityGUID(hash); } }
public void Read(byte[] buffer) { using (MemoryStream baseStream = new MemoryStream(buffer)) { using (EndianStream stream = new EndianStream(baseStream)) { Read(stream); if (stream.BaseStream.Position != buffer.Length) { throw new Exception($"Read less {stream.BaseStream.Position} than expected {buffer.Length}"); } } } if (Config.IsGenerateGUIDByContent) { using (MD5 md5 = MD5.Create()) { byte[] md5Hash = md5.ComputeHash(buffer); GUID = new UnityGUID(md5Hash); } } }