Adventure Creator  1.72.0
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2019
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.RememberHotspot AC.RememberMaterial AC.RememberMoveable AC.RememberName AC.RememberNavMesh2D AC.RememberNPC AC.RememberParticleSystem AC.RememberShapeable AC.RememberSound AC.RememberTimeline AC.RememberTrack AC.RememberTrigger AC.RememberVariables AC.RememberVideoPlayer AC.RememberVisibility

Public Member Functions

virtual string SaveData ()
 Serialises appropriate GameObject values into a string. Overriden by subclasses. More...
 
virtual void LoadData (string stringData)
 Deserialises a string of data, and restores the GameObject to its previous state. Overridden by subclasses. More...
 
int AssignInitialValue (bool forcePrefab=false)
 Sets a new Constant ID number. More...
 
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. More...
 
static T GetComponent< T > (int constantIDValue)
 Gets a component in the Hierarchy that also has a ConstantID component on the same GameObject. More...
 
static ConstantID GetComponent (int constantIDValue)
 Gets a ConstantID component in the Hierarchy with a given ID number. More...
 
static HashSet< T > GetComponents< T > (int constantIDValue, Scene scene)
 Gets all components of a particular type within the scene, with a given ConstantID number. More...
 
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. More...
 
static T GetComponent< T > (int constantIDValue, Scene scene, bool sceneOnlyPrioritises=false)
 Gets a component associated with a given ConstantID number, in a particular scene More...
 
static ConstantID GetComponent (int constantIDValue, Scene scene, bool sceneOnlyPrioritises=false)
 Gets a ConstantID component ID number, in a particular scene More...
 
static void FindLocalReferences (MenuCommand command)
 
static void FindGlobalReferences (MenuCommand command)
 

Public Attributes

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

Protected Member Functions

bool GameIsPlaying ()
 
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.

◆ GetComponent() [1/2]

static 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]

static 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]

static T AC.ConstantID.GetComponent< T > ( int  constantIDValue)
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
Returns
The component with a matching Constant ID number
Type Constraints
T :Component 

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

static 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]

static 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]

static 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]

static 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 

◆ LoadData()

virtual void AC.ConstantID.LoadData ( string  stringData)
virtual

◆ 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