Class IdentifiableBehaviour
This class allows mono behaviours to be consistently identifiable in Unity.
When such a MonoBehaviour is added in the editor, its Id is set and will be unique.
Dynamically created Identifiable Behaviours are also given an Id
Inheritance
IdentifiableBehaviour
Assembly: Xareus.Relations.Unity.dll
Syntax
public class IdentifiableBehaviour : MonoBehaviour
Fields
id
The identifier of this relation
Declaration
Field Value
Properties
Id
Declaration
public string Id { get; set; }
Property Value
Methods
Awake()
Declaration
protected virtual void Awake()
DefaultId()
Override this method to change the default Id a behaviour will get (default is the name of the game object)
Declaration
protected virtual string DefaultId()
Returns
Equals(object)
Declaration
public override bool Equals(object other)
Parameters
Type |
Name |
Description |
object |
other |
|
Returns
Overrides
FreeId()
Declaration
GenerateNewId()
Declaration
protected void GenerateNewId()
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
GetIdentifiable(string)
Get the Identifiable from its id
Declaration
public static IdentifiableBehaviour GetIdentifiable(string id)
Parameters
Type |
Name |
Description |
string |
id |
|
Returns
HasIdentifiable(string)
Check if an Identifiable with the given id exists
Declaration
public static bool HasIdentifiable(string id)
Parameters
Type |
Name |
Description |
string |
id |
|
Returns
OnIdChanged(string)
Called when the Id is changed
Declaration
protected virtual void OnIdChanged(string previousId)
Parameters
Type |
Name |
Description |
string |
previousId |
|
OnValidate()
Called in the editor when any change is made on a mono behaviour. This ensures that the Id is unique
Declaration
protected virtual void OnValidate()