static unsafe void RegisterConversionSystems() { var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.GameObjectConversion | WorldSystemFilterFlags.EntitySceneOptimizations); var nameAndVersion = new NameAndVersion[systems.Count]; for (int i = 0; i != nameAndVersion.Length; i++) { nameAndVersion[i].FullName = systems[i].FullName; var systemVersionAttribute = systems[i].GetCustomAttribute <ConverterVersionAttribute>(); if (systemVersionAttribute != null) { nameAndVersion[i].Version = systemVersionAttribute.Version; } } Array.Sort(nameAndVersion); UnityEngine.Hash128 hash = default; for (int i = 0; i != nameAndVersion.Length; i++) { var fullName = nameAndVersion[i].FullName; fixed(char *str = fullName) { HashUnsafeUtilities.ComputeHash128(str, (ulong)(sizeof(char) * fullName.Length), &hash); } int version = nameAndVersion[i].Version; HashUnsafeUtilities.ComputeHash128(&version, sizeof(int), &hash); } UnityEditor.Experimental.AssetDatabaseExperimental.RegisterCustomDependency(SystemsVersion, hash); }
static unsafe void RegisterConversionSystems() { var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.GameObjectConversion | WorldSystemFilterFlags.EntitySceneOptimizations); var behaviours = TypeCache.GetTypesDerivedFrom <IConvertGameObjectToEntity>(); var nameAndVersion = new NameAndVersion[systems.Count + behaviours.Count]; int count = 0; // System versions for (int i = 0; i != systems.Count; i++) { var fullName = systems[i].FullName; if (fullName == null) { continue; } nameAndVersion[count++].Init(systems[i], fullName); } // IConvertGameObjectToEntity versions for (int i = 0; i != behaviours.Count; i++) { var fullName = behaviours[i].FullName; if (fullName == null) { continue; } nameAndVersion[count++].Init(behaviours[i], fullName); } Array.Sort(nameAndVersion, 0, count); UnityEngine.Hash128 hash = default; for (int i = 0; i != count; i++) { var fullName = nameAndVersion[i].FullName; fixed(char *str = fullName) { HashUnsafeUtilities.ComputeHash128(str, (ulong)(sizeof(char) * fullName.Length), &hash); } var userName = nameAndVersion[i].UserName; if (userName != null) { fixed(char *str = userName) { HashUnsafeUtilities.ComputeHash128(str, (ulong)(sizeof(char) * userName.Length), &hash); } } int version = nameAndVersion[i].Version; HashUnsafeUtilities.ComputeHash128(&version, sizeof(int), &hash); } AssetDatabaseCompatibility.RegisterCustomDependency(SystemsVersion, hash); }
private static NameAndVersion __GetVersion(string agent, XmlDocument xml) { NameAndVersion nv = new NameAndVersion(); Match _match; foreach (XmlNode _xn in xml.DocumentElement.ChildNodes) { _match = Regex.Match(agent, _xn.Attributes["regexp"].Value, RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase); if (!_match.Success) { continue; } nv.Name = _xn.Attributes["name"].Value; if (_match.Groups["ver"].Success) { nv.Version = _match.Groups["ver"].Value; } break; } return(nv); }
private static NameAndVersion __GetVersion(string agent, XmlDocument xml) { NameAndVersion nv = new NameAndVersion(); Match _match; foreach(XmlNode _xn in xml.DocumentElement.ChildNodes) { _match = Regex.Match(agent, _xn.Attributes["regexp"].Value, RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase); if(!_match.Success) continue; nv.Name = _xn.Attributes["name"].Value; if(_match.Groups["ver"].Success) nv.Version = _match.Groups["ver"].Value; break; } return nv; }
public override int GetHashCode() { return(NameAndVersion.GetHashCode()); }