/// <inheritdoc /> public ITypeMetadata Resolve(TypeHandle th) { if (!m_MetadataCache.TryGetValue(th, out ITypeMetadata metadata)) { metadata = m_MetadataCache.GetOrAdd(th, t => new TypeMetadata(t, th.Resolve())); } return(metadata); }
/// <summary> /// Creates a type handle for a custom type. /// </summary> /// <param name="uniqueId">The unique identifier for the custom type.</param> /// <returns>A type handle representing the custom type.</returns> public static TypeHandle GenerateCustomTypeHandle(string uniqueId) { TypeHandle th; var typeHandleMapping = s_CustomIdToTypeHandle.Find(e => e.Item1 == uniqueId); if (typeHandleMapping != default) { Debug.LogWarning(uniqueId + " is already registered in TypeSerializer"); return(typeHandleMapping.Item2); } th = new TypeHandle(uniqueId); s_CustomIdToTypeHandle.Add((uniqueId, th)); return(th); }
internal static Type ResolveType(TypeHandle th) { return(Deserialize(th.Identification)); }
/// <summary> /// Initializes a new instance of the <see cref="TypeMetadata" /> class. /// </summary> /// <param name="typeHandle">The <see cref="TypeHandle"/> instance represented by the metadata.</param> /// <param name="type">The type represented by <paramref name="typeHandle"/>.</param> public TypeMetadata(TypeHandle typeHandle, Type type) { TypeHandle = typeHandle; m_Type = type; }