Skip to main content

Class SerializableMonoScript

Namespace: Aspid.FastTools.Types
Assembly: Aspid.FastTools.dll

Unity-serializable wrapper around a Type referencing it through its MonoScript asset, so renaming or moving the class does not break the field.

[Serializable]
public class SerializableMonoScript : SerializableTypeBase, ISerializableType, IEquatable<SerializableTypeBase>, ISerializationCallbackReceiver

Inheritance​

object ← SerializableTypeBase ← SerializableMonoScript

Derived​

SerializableMonoScript<T>

Implements​

ISerializableType, IEquatable<SerializableTypeBase>, ISerializationCallbackReceiver

Extension Methods​

ProfilerMarkerExtensionsForGenerator.Marker<SerializableMonoScript>(SerializableMonoScript, int)

Examples​

[SerializeField] private SerializableMonoScript _componentType;

Type type = _componentType; // implicit conversion

Remarks​

A script asset exists only for a top-level, non-generic class in a file of the same name, or for a MonoBehaviour or ScriptableObject in a DLL, matched by namespace and name; use SerializableType for other types. A player keeps only the name and resolves it as SerializableType does.

Properties​

BaseType​

Gets the base type that types offered by the picker are assignable to; Object when unconstrained.

public override Type BaseType { get; }

Property Value​

Type

Remarks​

A loaded type is not checked against it: a name stored before the constraint changed resolves as is.

Operators​

implicit operator Type?(SerializableMonoScript?)​

Converts the wrapper to the type it holds.

public static implicit operator Type?(SerializableMonoScript? type)

Parameters​

type SerializableMonoScript?

The wrapper to convert.

Returns​

Type?

The wrapped type, or null when the wrapper is null or holds no resolvable type.