Unity Utils

Overview

Use this component to execute simple unity logics such as Parent, Instantiate, Destroy, Disable. Use it via Unity Events

How to use it

You can use this component methods via Unity Events in the inspector. Use it every time you need to Instantiate, Destroy, Parent or do any simple unity logics.

Methods

void Time_Freeze(bool value)

If true, it sets Time.timeScale = 0. If false, it sets Time.timeScale = 1

void Time_Scale(float value)

Sets Time.timeScale = value

void DestroyMe(float time)

Destroys the gameobject that holds the UnityUtils component after a given time.

void DestroyMe()

Destroys the gameobject that holds the UnityUtils component.

void DestroyMeNextFrame()

Destroys the gameobject that holds the UnityUtils component in the next frame.

void DestroyGameObject(GameObject value)

Destroys a GameObject.

void DestroyComponent(Component value)

Destroys a Component.

void Reset_GameObject(GameObject value)

Disables a GameObject, and enables it back in the next frame.

void Reset_Monobehaviour(MonoBehaviour value)

Disables a Monobehaviour, and enables it back in the next frame.

void GameObjectHide(float time)

Hides the gameobject that holds the UnityUtils component after a given time.

void Parent(Transform, GameObject, Component value)

Parents the gameobject that holds the component to the given transform or gameobject.

void Parent_Local(Transform, GameObject, Component value)

Unparents the given transform or gameobject, and it sets the Local Position and rotation to Zero.

void Unparent(Transform, GameObject, Component value)

Unparents the given transform or gameobject.

void RandomRotateAroundX()

Rotates randomly on the X axis the gameobject that holds the UnityUtils component.

void RandomRotateAroundY()

Rotates randomly on the Y axis the gameobject that holds the UnityUtils component.

void RandomRotateAroundZ()

Rotates randomly on the Z axis the gameobject that holds the UnityUtils component.

void Behaviour_Enable(int index)

Enables a behaviour on a gameobject using its index of all the behaviours attached to the gameobject. Useful when they're duplicated components in a same gameobject.

void Behaviour_Disable(int index)

Disables a behaviour on a gameobject using its index of all the behaviours attached to the gameobject. Useful when they're duplicated components in a same gameobject.

void Dont_Destroy_On_Load(GameObject value)

Adds a gameobject to the DontDestroyOnLoad logic.

void Load_Scene_Additive(string value)

Loads an additively new scene.

void Load_Scene(string value)

Loads a new scene.

void Rotation_Reset()

Resets the Local Rotation of the transform that holds this UnityUtils component.

void Position_Reset()

Resets the Local Position of the transform that holds this UnityUtils component.

void Rotation_Reset(GameObject,Transform value)

Resets the Local Rotation of a gameobject or transform.

void Position_Reset(GameObject,Transform value)

Resets the Local Position of a gameobject or transform.

void Instantiate(GameObject value)

Instantiates a GameObject in the position of the transform that holds this UnityUtils component.

void InstantiateAndParent(GameObject value)

Instantiates a GameObject in the position of the transform that holds this UnityUtils component. It also parents the new instantiated gameobject to the transform that holds this UnityUtils component.

void ShowCursor(bool value)

Shows/Hides the Cursor.

Last updated