Class SerializableTypeBase
Namespace: Aspid.FastTools.Types
Assembly: Aspid.FastTools.dll
Shared base of the serializable Type wrappers: stores the type by its assembly-qualified
name and resolves it lazily.
[Serializable]
public abstract class SerializableTypeBase : ISerializableType, IEquatable<SerializableTypeBase>, ISerializationCallbackReceiver
Inheritance
Derived
SerializableMonoScript, SerializableType
Implements
ISerializableType, IEquatable<SerializableTypeBase>, ISerializationCallbackReceiver
Extension Methods
ProfilerMarkerExtensionsForGenerator.Marker<SerializableTypeBase>(SerializableTypeBase, int)
Remarks
A player resolves only the stored name, which managed code stripping does not see: from Managed Stripping
Level Medium up, keep a class referenced only here with [Preserve] or link.xml. A failed lookup
is cached until the name changes or the object is deserialized again, so an assembly loaded later is missed.
Properties
AssemblyQualifiedName
Gets the stored assembly-qualified type name, or an empty string when no type is stored.
public string AssemblyQualifiedName { get; }
Property Value
BaseType
Gets the base type that types offered by the picker are assignable to; Object when unconstrained.
public abstract Type BaseType { get; }
Property Value
Remarks
A loaded type is not checked against it: a name stored before the constraint changed resolves as is.
IsEmpty
Gets a value indicating whether no type is stored.
public bool IsEmpty { get; }
Property Value
Remarks
On an object created in code the field itself stays null until Unity serializes it:
test an unset field with field is null || field.IsEmpty.
IsMissing
Gets a value indicating whether a type name is stored but does not resolve, for example after the class was renamed, moved or stripped from a player build.
public bool IsMissing { get; }
Property Value
Type
Gets the resolved type, or null when no type is stored or its stored name cannot be resolved.
public Type? Type { get; }
Property Value
Type?
Methods
Equals(SerializableTypeBase?)
Determines whether other stores the same assembly-qualified name, whatever its wrapper
class or constraint.
public bool Equals(SerializableTypeBase? other)
Parameters
other SerializableTypeBase?
The wrapper to compare with.
Returns
true if other is not null and stores the same
name, also when neither stores a type; otherwise, false.
Remarks
== still compares references.
Equals(object?)
Determines whether obj is a wrapper that stores the same assembly-qualified name.
public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with.
Returns
true if obj is such a wrapper; otherwise, false.
GetHashCode()
Returns a hash code of the stored assembly-qualified name.
public override int GetHashCode()
Returns
Remarks
Follows the stored name: do not change a wrapper used as a key, also through Unity serialization.
ToString()
Returns the short name of the resolved type, the stored name when it cannot be resolved, or an empty string when no type is stored.
public override string ToString()