Adventure Creator 1.84.3
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2024
Loading...
Searching...
No Matches
AC.ConstantID Class Reference
Inheritance diagram for AC.ConstantID:
AC.Remember AC.RememberTransform AC.RememberActionListParameters AC.RememberAnimator AC.RememberCollider AC.RememberContainer AC.RememberConversation AC.RememberFootstepSounds AC.RememberGameCamera2DDrag AC.RememberHotspot AC.RememberMaterial AC.RememberMoveable AC.RememberNPC AC.RememberName AC.RememberNavMesh2D AC.RememberParticleSystem AC.RememberSceneItem AC.RememberShapeable AC.RememberSound AC.RememberTimeline AC.RememberTrack AC.RememberTrigger AC.RememberVariables AC.RememberVideoPlayer AC.RememberVisibility

Public Member Functions

virtual void OnSpawn ()
virtual string SaveData ()
 Serialises appropriate GameObject values into a string. Overriden by subclasses.
void SetManualID (int _id)
int AssignInitialValue (bool forcePrefab=false)
 Sets a new Constant ID number.
void SetNewID_Prefab ()

Static Public Member Functions

static HashSet< T > GetComponents< T > (int constantIDValue)
 Gets all components in the Hierarchy that also have a ConstantID component on the same GameObject.
static T GetComponent< T > (int constantIDValue, GameObject root=null)
 Gets a component in the Hierarchy that also has a ConstantID component on the same GameObject.
static ConstantID GetComponent (int constantIDValue)
 Gets a ConstantID component in the Hierarchy with a given ID number.
static HashSet< T > GetComponents< T > (int constantIDValue, Scene scene)
 Gets all components of a particular type within the scene, with a given ConstantID number.
static HashSet< T > GetComponents< T > (Scene scene)
 Gets all components of a particular type within the scene. Only components with an associated ConstantID number will be returned.
static T GetComponent< T > (int constantIDValue, Scene scene, bool sceneOnlyPrioritises=false)
 Gets a component associated with a given ConstantID number, in a particular scene.
static ConstantID GetComponent (int constantIDValue, Scene scene, bool sceneOnlyPrioritises=false)
 Gets a ConstantID component ID number, in a particular scene.
static void FindLocalReferences (MenuCommand command)
static void FindGlobalReferences (MenuCommand command)

Public Attributes

int constantID
bool retainInPrefab = false
AutoManual autoManual = AutoManual.Automatic

Protected Member Functions

void OnEnable ()
virtual void Start ()
void OnDisable ()
virtual void OnInitialiseScene ()
bool[] StringToBoolArray (string _string)
int[] StringToIntArray (string _string)
float[] StringToFloatArray (string _string)
string[] StringToStringArray (string _string)
string ArrayToString< T > (T[] _list)
void Update ()

Detailed Description

This script is used by the Serialization classes to store a permanent ID of the gameObject (like InstanceID, only retained after reloading the project). To save a reference to an arbitrary object in a scene, this script must be attached to it.

Member Function Documentation

◆ AssignInitialValue()

int AC.ConstantID.AssignInitialValue ( bool forcePrefab = false)

Sets a new Constant ID number.

Parameters
forcePrefabIf True, sets "retainInPrefab" to True. Otherwise, it will be determined by whether or not the component is part of an asset file.
Returns
The new Constant ID number

◆ GetComponent() [1/2]

ConstantID AC.ConstantID.GetComponent ( int constantIDValue)
static

Gets a ConstantID component in the Hierarchy with a given ID number.

Parameters
constantIDThe ID number to search for
Returns
The ConstantID component with the matching ID number

◆ GetComponent() [2/2]

ConstantID AC.ConstantID.GetComponent ( int constantIDValue,
Scene scene,
bool sceneOnlyPrioritises = false )
static

Gets a ConstantID component ID number, in a particular scene.

Parameters
constantIDValueThe ID number to search for
sceneThe scene to search
sceneOnlyPrioritisesIf True, then the supplied scene is searched first, but all other scenes are then searched if no result is yet found
Returns
The ConstantID component associated with the ID number

◆ GetComponent< T >() [1/2]

T AC.ConstantID.GetComponent< T > ( int constantIDValue,
GameObject root = null )
static

Gets a component in the Hierarchy that also has a ConstantID component on the same GameObject.

Parameters
constantIDThe Constant ID number generated by the ConstantID component
rootIf provided, only components on this or children of this object will be searched
Returns
The component with a matching Constant ID number
Type Constraints
T :Component 

◆ GetComponent< T >() [2/2]

T AC.ConstantID.GetComponent< T > ( int constantIDValue,
Scene scene,
bool sceneOnlyPrioritises = false )
static

Gets a component associated with a given ConstantID number, in a particular scene.

Parameters
constantIDValueThe ID number to search for
sceneThe scene to search
sceneOnlyPrioritisesIf True, then the supplied scene is searched first, but all other scenes are then searched if no result is yet found
Returns
The component associated with the Constant ID number
Type Constraints
T :Component 

◆ GetComponents< T >() [1/3]

HashSet< T > AC.ConstantID.GetComponents< T > ( int constantIDValue)
static

Gets all components in the Hierarchy that also have a ConstantID component on the same GameObject.

Parameters
constantIDThe Constant ID number generated by the ConstantID component
Returns
The components with a matching Constant ID number
Type Constraints
T :Component 

◆ GetComponents< T >() [2/3]

HashSet< T > AC.ConstantID.GetComponents< T > ( int constantIDValue,
Scene scene )
static

Gets all components of a particular type within the scene, with a given ConstantID number.

Parameters
constantIDValueThe ID number to search for
sceneThe scene to search
Returns
All components of the give type in the scene, provided they have an associated ConstantID
Type Constraints
T :Component 

◆ GetComponents< T >() [3/3]

HashSet< T > AC.ConstantID.GetComponents< T > ( Scene scene)
static

Gets all components of a particular type within the scene. Only components with an associated ConstantID number will be returned.

Parameters
sceneThe scene to search
Returns
All components of the give type in the scene, provided they have an associated ConstantID
Type Constraints
T :Component 

◆ OnSpawn()

virtual void AC.ConstantID.OnSpawn ( )
virtual

Initialises the component. This needs to be called if the object it is attached to is generated/spawned at runtime manually through code.

Reimplemented in AC.RememberTransform.

◆ SaveData()

◆ SetNewID_Prefab()

void AC.ConstantID.SetNewID_Prefab ( )

Sets a new Constant ID number for a prefab.

Member Data Documentation

◆ autoManual

AutoManual AC.ConstantID.autoManual = AutoManual.Automatic

Is the Constant ID set automatically or manually?

◆ constantID

int AC.ConstantID.constantID

The recorded Constant ID number

◆ retainInPrefab

bool AC.ConstantID.retainInPrefab = false

If True, prefabs will share the same Constant ID as their scene-based counterparts