Adventure Creator 1.84.3
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2024
Loading...
Searching...
No Matches
AC.UnityVersionHandler Class Reference

Static Public Member Functions

static T FindObjectOfType< T > ()
static T[] FindObjectsOfType< T > ()
static T[] FindObjectsOfType< T > (bool includeInactive)
static Object[] FindObjectsOfType (System.Type type)
static RaycastHit2D Perform2DRaycast (Vector2 origin, Vector2 direction, float length, LayerMask layerMask)
 Performs a Physics2D.Raycast on Triggers in the scene.
static RaycastHit2D Perform2DRaycast (Vector2 origin, Vector2 direction, float length)
 Performs a Physics2D.Raycast on Triggers in the scene.
static int Perform2DRaycasts (ref RaycastHit2D[] hits, Vector2 origin, Vector2 direction, float length, LayerMask layerMask)
static int GetSceneIndexFromGameObject (GameObject _gameObject)
 Gets the buld index of the scene that a given GameObject is in.
static string GetSceneNameFromGameObject (GameObject _gameObject)
 Gets the name of the scene that a given GameObject is in.
static LocalVariables GetLocalVariablesOfGameObject (GameObject _gameObject)
 Gets the LocalVariables component that is in the same scene as a given GameObject.
static SceneSettings GetSceneSettingsOfGameObject (GameObject _gameObject)
 Gets the SceneSettings component that is in the same scene as a given GameObject.
static bool CanUseJson ()
 Checks if Json serialization is supported by the current version of Unity.
static bool PutInFolder (GameObject ob, string folderName)
 Places a supplied GameObject in a "folder" scene object, as generated by the Scene Manager.
static string GetCurrentSceneName ()
 Gets the name of the active scene, if multiple scenes are being edited.
static void NewScene ()
static bool OpenScene (string sceneName)
static void SaveScene ()
static bool SaveSceneIfUserWants ()
static bool ObjectIsInActiveScene (string gameObjectName, bool persistentIsValid=true)
 Checks if a suppplied GameObject is present within the active scene.
static T AddComponentToGameObject< T > (GameObject gameObject)
 Adds a component to a GameObject, which can be a prefab or a scene-based object.
static T AddConstantIDToGameObject< T > (GameObject gameObject, bool forcePrefab=false)
 Adds a ConstantID component to a GameObject, which can be a prefab or a scene-based object.
static void AssignIDsToTranslatable (ITranslatable translatable, int[] lineIDs, bool isInScene, bool isMonoBehaviour)
static bool IsPrefabFile (Object _target)
 Checks if a given object is part of an original prefab (as opposed to an instance of one).
static bool IsPrefabEditing (Object _target)
static GameObject GetPrefabStageRoot ()
static void CustomSetDirty (Object _target, bool force=false)
static string GetCurrentSceneFilepath ()
static bool ShouldAssignPrefabConstantID (GameObject gameObject)
static bool ObjectIsInActiveScene (GameObject gameObject, bool persistentIsValid=true)
 Checks if a suppplied GameObject is present within the active scene. The GameObject must be in the Hierarchy at runtime.
static T GetKickStarterComponent< T > ()
static T GetOwnSceneInstance< T > (GameObject gameObject)
 Gets a Behaviour that is in the same scene as a given GameObject.
static T GetSceneInstance< T > (UnityEngine.SceneManagement.Scene scene)
static void SetRigidbodyVelocity (Rigidbody rigidbody, Vector3 velocity)
static Vector3 GetRigidbodyVelocity (Rigidbody rigidbody)
static void SetRigidbodyDrag (Rigidbody rigidbody, float drag)
static float GetRigidbodyDrag (Rigidbody rigidbody)
static void SetRigidbodyAngularDrag (Rigidbody rigidbody, float drag)
static float GetRigidbodyAngularDrag (Rigidbody rigidbody)
static void SetRigidbody2DKinematic (Rigidbody2D rigidbody, bool value)
static bool GetRigidbody2DKinematic (Rigidbody2D rigidbody)
static Vector3 GetRigidbody2DVelocity (Rigidbody2D rigidbody)

Properties

static bool CursorLock [get, set]

Detailed Description

This is a class that contains commonly-used functions that vary depending on which version of Unity is being used.

Member Function Documentation

◆ AddComponentToGameObject< T >()

T AC.UnityVersionHandler.AddComponentToGameObject< T > ( GameObject gameObject)
static

Adds a component to a GameObject, which can be a prefab or a scene-based object.

Parameters
gameObjectThe GameObject to amend
Returns
The GameObject's component
Type Constraints
T :Component 

◆ AddConstantIDToGameObject< T >()

T AC.UnityVersionHandler.AddConstantIDToGameObject< T > ( GameObject gameObject,
bool forcePrefab = false )
static

Adds a ConstantID component to a GameObject, which can be a prefab or a scene-based object.

Parameters
gameObjectThe GameObject to amend
Returns
The GameObject's component
Type Constraints
T :ConstantID 

◆ CanUseJson()

bool AC.UnityVersionHandler.CanUseJson ( )
static

Checks if Json serialization is supported by the current version of Unity.

Returns
True if Json serialization is supported by the current version of Unity.

◆ CustomSetDirty()

void AC.UnityVersionHandler.CustomSetDirty ( Object _target,
bool force = false )
static

Marks an object as dirty so that changes made will be saved. In Unity 5.3 and above, the scene itself is marked as dirty to ensure it is properly changed.

Parameters
_targetThe object to mark as dirty
forceIf True, then the object will be marked as dirty regardless of whether or not GUI.changed is true. This should not be set if called every frame.

◆ FindObjectOfType< T >()

T AC.UnityVersionHandler.FindObjectOfType< T > ( )
static
Type Constraints
T :Object 

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

T[] AC.UnityVersionHandler.FindObjectsOfType< T > ( )
static
Type Constraints
T :Object 

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

T[] AC.UnityVersionHandler.FindObjectsOfType< T > ( bool includeInactive)
static
Type Constraints
T :Object 

◆ GetCurrentSceneName()

string AC.UnityVersionHandler.GetCurrentSceneName ( )
static

Gets the name of the active scene, if multiple scenes are being edited.

Returns
The name of the active scene, if multiple scenes are being edited. Returns nothing otherwise.

◆ GetKickStarterComponent< T >()

T AC.UnityVersionHandler.GetKickStarterComponent< T > ( )
static

Finds the correct instance of a component required by the KickStarter script.

Type Constraints
T :Behaviour 

◆ GetLocalVariablesOfGameObject()

LocalVariables AC.UnityVersionHandler.GetLocalVariablesOfGameObject ( GameObject _gameObject)
static

Gets the LocalVariables component that is in the same scene as a given GameObject.

Parameters
_gameObjectThe GameObject in the scene
Returns
The LocalVariables component that is in the same scene as the given GameObject

◆ GetOwnSceneInstance< T >()

T AC.UnityVersionHandler.GetOwnSceneInstance< T > ( GameObject gameObject)
static

Gets a Behaviour that is in the same scene as a given GameObject.

Parameters
_gameObjectThe GameObject in the scene
Returns
The Behaviour that is in the same scene as the given GameObject
Type Constraints
T :Behaviour 

◆ GetSceneIndexFromGameObject()

int AC.UnityVersionHandler.GetSceneIndexFromGameObject ( GameObject _gameObject)
static

Gets the buld index of the scene that a given GameObject is in.

Parameters
_gameObjectThe GameObject in the scene
Returns
The build index of the scene that a given GameObject is in.

◆ GetSceneInstance< T >()

T AC.UnityVersionHandler.GetSceneInstance< T > ( UnityEngine.SceneManagement.Scene scene)
static
Type Constraints
T :Behaviour 

◆ GetSceneNameFromGameObject()

string AC.UnityVersionHandler.GetSceneNameFromGameObject ( GameObject _gameObject)
static

Gets the name of the scene that a given GameObject is in.

Parameters
_gameObjectThe GameObject in the scene
Returns
The name of the scene that a given GameObject is in.

◆ GetSceneSettingsOfGameObject()

SceneSettings AC.UnityVersionHandler.GetSceneSettingsOfGameObject ( GameObject _gameObject)
static

Gets the SceneSettings component that is in the same scene as a given GameObject.

Parameters
_gameObjectThe GameObject in the scene
Returns
The SceneSettings component that is in the same scene as the given GameObject

◆ IsPrefabFile()

bool AC.UnityVersionHandler.IsPrefabFile ( Object _target)
static

Checks if a given object is part of an original prefab (as opposed to an instance of one).

Parameters
_targetThe object being checked
Returns
True if the object is part of an original prefab

◆ ObjectIsInActiveScene() [1/2]

bool AC.UnityVersionHandler.ObjectIsInActiveScene ( GameObject gameObject,
bool persistentIsValid = true )
static

Checks if a suppplied GameObject is present within the active scene. The GameObject must be in the Hierarchy at runtime.

Parameters
gameObjectThe GameObject to check for
persistentIsValidIf True, then objects marked as "DontDestroyOnLoad" will also be valid
Returns
True if the GameObject is present within the active scene

◆ ObjectIsInActiveScene() [2/2]

bool AC.UnityVersionHandler.ObjectIsInActiveScene ( string gameObjectName,
bool persistentIsValid = true )
static

Checks if a suppplied GameObject is present within the active scene.

Parameters
gameObjectNameThe name of the GameObject to check for
persistentIsValidIf True, then objects marked as "DontDestroyOnLoad" will also be valid
Returns
True if the GameObject is present within the active scene.

◆ Perform2DRaycast() [1/2]

RaycastHit2D AC.UnityVersionHandler.Perform2DRaycast ( Vector2 origin,
Vector2 direction,
float length )
static

Performs a Physics2D.Raycast on Triggers in the scene.

Parameters
originThe ray's origin
directionThe ray's direction
lengthThe ray's length
Returns
The result of the Physics2D.Raycast

◆ Perform2DRaycast() [2/2]

RaycastHit2D AC.UnityVersionHandler.Perform2DRaycast ( Vector2 origin,
Vector2 direction,
float length,
LayerMask layerMask )
static

Performs a Physics2D.Raycast on Triggers in the scene.

Parameters
originThe ray's origin
directionThe ray's direction
layerMaskThe LayerMask to act upon
Returns
The result of the Physics2D.Raycast

◆ PutInFolder()

bool AC.UnityVersionHandler.PutInFolder ( GameObject ob,
string folderName )
static

Places a supplied GameObject in a "folder" scene object, as generated by the Scene Manager.

Parameters
obThe GameObject to move into a folder
folderNameThe name of the folder scene object
Returns
True if a suitable folder object was found, and ob was successfully moved.

Property Documentation

◆ CursorLock

bool AC.UnityVersionHandler.CursorLock
staticgetset

The 'lock' state of the cursor.