IUnityObject
Root interface mirroring UnityEngine.Object. Defines the identity and equality contract common to all Unity objects — instance ID, name, hide flags, and standard object methods. This is the base of both the IComponent chain (scene objects) and IScriptableObject (asset objects).
Definition
Namespace: Paragon Assembly: Paragon.dll
public interface IUnityObjectRemarks
IUnityObject mirrors the public API surface of UnityEngine.Object that is relevant for identity and serialization control. Any class inheriting from UnityEngine.Object (which includes MonoBehaviour, ScriptableObject, Component, etc.) inherently satisfies this interface — no explicit IUnityObject declaration is needed on the class.
The interface serves as the common root for two inheritance branches:
Scene objects:
IUnityObject→ IComponent → IBehaviour → IMonoBehaviourAsset objects:
IUnityObject→ IScriptableObject
Properties
name
The name of the object. Maps to UnityEngine.Object.name.
string name { get; set; }hideFlags
Bit mask controlling object visibility and persistence in the editor and at runtime. Maps to UnityEngine.Object.hideFlags.
Methods
GetInstanceID
Returns the unique instance ID assigned by Unity. Stable for the lifetime of the object.
Returns: Unique integer identifier.
GetHashCode
Returns a hash code for the object. Maps to UnityEngine.Object.GetHashCode().
Equals
Determines whether the specified object is equal to this instance. Maps to UnityEngine.Object.Equals().
other
object
The object to compare
Returns: true if the objects are equal (by Unity's reference equality rules).
ToString
Returns a string representation of the object. Maps to UnityEngine.Object.ToString().
Implementation Requirements
You do not need to implement this interface explicitly. Any class deriving from UnityEngine.Object already has all these members. The interface exists to enable interface-based programming against Unity types.
For non-Unity objects that implement IUnityObject (e.g., FactorableObject via its GetInstanceID() override), you MUST:
Provide a unique
GetInstanceID()value (seeFactorableObject's thread-safe counter pattern)Implement meaningful
Equals()andGetHashCode()for collection usage
See Also
IComponent — extends this for scene objects
IScriptableObject — extends this for asset objects
Unity Interfaces — hierarchy overview
Last updated