FYFY 2.3
Loading...
Searching...
No Matches
FYFY.GameObjectManager Class Reference

Manager of GameObject. More...

Static Public Member Functions

static void loadScene (int sceneBuildIndex, UnityEngine.SceneManagement.LoadSceneMode mode=UnityEngine.SceneManagement.LoadSceneMode.Single)
 Loads the specified scene at the beginning of the next update block.
 
static void loadScene (string sceneName, UnityEngine.SceneManagement.LoadSceneMode mode=UnityEngine.SceneManagement.LoadSceneMode.Single)
 Loads the scene at the beginning of the next update block.
 
static void unloadScene (string sceneName)
 Destroys all GameObjects associated with the given Scene and removes the Scene from the SceneManager.
 
static void unloadScene (int sceneBuildIndex)
 Destroys all GameObjects associated with the given Scene and removes the Scene from the SceneManager.
 
static void dontDestroyOnLoadAndRebind (GameObject target)
 Makes the game object target not be destroyed automatically when loading a new scene and rebind it automatically with FYFY.
 
static void bind (GameObject gameObject, bool recursive=true)
 Bind a game object with FYFY. The game object will be registered by FYFY at the beginning of the next update block.
 
static void unbind (GameObject gameObject, bool recursive=true)
 Unbind a game object to FYFY at the beginning of the next update block.
 
static bool isBound (GameObject gameObject)
 Return true if the gameObject is bound, false else.
 
static void setGameObjectState (GameObject gameObject, bool enabled)
 Sets the state (enable/disable) of the game object at the beginning of the next update block.
 
static void setGameObjectParent (GameObject gameObject, GameObject parent, bool worldPositionStays)
 Sets the game object parent at the beginning of the next update block.
 
static void setGameObjectLayer (GameObject gameObject, int layer)
 Sets the game object layer at the beginning of the next update block.
 
static void setGameObjectTag (GameObject gameObject, string tag)
 Sets the game object tag at the beginning of the next update block.
 
static void addComponent< T > (GameObject gameObject, object componentValues=null)
 Adds a component to the game object at the beginning of the next update block.
 
static void addComponent (GameObject gameObject, System.Type componentType, object componentValues=null)
 Adds a component to the game object at the beginning of the next update block.
 
static void removeComponent< T > (GameObject gameObject)
 Removes a component of a game object at the beginning of the next update block.
 
static void removeComponent (Component component)
 Removes the component from its game object at the beginning of the next update block.
 
static void refresh (GameObject gameObject)
 Force FYFY to refresh families for this GameObject at the beginning of the next update block.
 

Properties

static int Count [get]
 Gets the number of GameObjects of the scene known by FYFY.
 

Detailed Description

Manager of GameObject.

You must use the FYFY.GameObjectManager functions when you deal with FYFY otherwise, FYFY can't retrieve information to maintain uptodate families.

When you call a FYFY.GameObjectManager function, the real action is done at the beginning of the next update block. This has the effect to maintain a consistent state inside a update block. For example, in a Update block, if you call the remove function on a component inside a system, the component is really removed in the next FYFY update (just before the Late update block in this example. For all the system in the Update block, the component is yet present.

Member Function Documentation

◆ addComponent()

static void FYFY.GameObjectManager.addComponent ( GameObject gameObject,
System.Type componentType,
object componentValues = null )
static

Adds a component to the game object at the beginning of the next update block.

Parameters
gameObjectThe game object to change.
componentTypeThe component type to add.
componentValuesThe component values to affect. It must be an anonymous type object.

◆ addComponent< T >()

static void FYFY.GameObjectManager.addComponent< T > ( GameObject gameObject,
object componentValues = null )
static

Adds a component to the game object at the beginning of the next update block.

Parameters
gameObjectThe game object to change.
componentValuesThe component values to affect. It must be an anonymous type object.
Template Parameters
TThe component type to add.
Type Constraints
T :Component 

◆ bind()

static void FYFY.GameObjectManager.bind ( GameObject gameObject,
bool recursive = true )
static

Bind a game object with FYFY. The game object will be registered by FYFY at the beginning of the next update block.

Parameters
gameObjectThe game object to bind.
recursiveShould bind child recursively (true default)

In the same frame of binding, you can use it in other FYFY.GameObjectManager.

◆ dontDestroyOnLoadAndRebind()

static void FYFY.GameObjectManager.dontDestroyOnLoadAndRebind ( GameObject target)
static

Makes the game object target not be destroyed automatically when loading a new scene and rebind it automatically with FYFY.

Parameters
targetThe game object to configure.

◆ isBound()

static bool FYFY.GameObjectManager.isBound ( GameObject gameObject)
static

Return true if the gameObject is bound, false else.

Parameters
gameObjectThe game object to check.

◆ loadScene() [1/2]

static void FYFY.GameObjectManager.loadScene ( int sceneBuildIndex,
UnityEngine.SceneManagement.LoadSceneMode mode = UnityEngine::SceneManagement::LoadSceneMode::Single )
static

Loads the specified scene at the beginning of the next update block.

Parameters
sceneBuildIndexIndex of the scene in the Build Settings to load.
modeAllows you to specify whether or not to load the Scene additively. See UnityEngine.SceneManagement.LoadSceneMode for more information about the options.

◆ loadScene() [2/2]

static void FYFY.GameObjectManager.loadScene ( string sceneName,
UnityEngine.SceneManagement.LoadSceneMode mode = UnityEngine::SceneManagement::LoadSceneMode::Single )
static

Loads the scene at the beginning of the next update block.

Parameters
sceneNameName of the scene to load.
modeAllows you to specify whether or not to load the Scene additively. See UnityEngine.SceneManagement.LoadSceneMode for more information about the options.

◆ removeComponent< T >()

static void FYFY.GameObjectManager.removeComponent< T > ( GameObject gameObject)
static

Removes a component of a game object at the beginning of the next update block.

Parameters
gameObjectThe game object to change.
Template Parameters
TThe component type to remove.
Type Constraints
T :Component 

◆ setGameObjectParent()

static void FYFY.GameObjectManager.setGameObjectParent ( GameObject gameObject,
GameObject parent,
bool worldPositionStays )
static

Sets the game object parent at the beginning of the next update block.

Parameters
gameObjectThe game object to change.
parentThe game object which become the new parent. This parameter can be null to reset the parent of gameObject .
worldPositionStaysIf true, the parent-relative position, scale and rotation is modified such that the object keeps the same world space position, rotation and scale as before.

◆ unbind()

static void FYFY.GameObjectManager.unbind ( GameObject gameObject,
bool recursive = true )
static

Unbind a game object to FYFY at the beginning of the next update block.

Parameters
gameObjectThe game object to unbind.
recursiveShould unbind child recursively (true default)

◆ unloadScene() [1/2]

static void FYFY.GameObjectManager.unloadScene ( int sceneBuildIndex)
static

Destroys all GameObjects associated with the given Scene and removes the Scene from the SceneManager.

Parameters
sceneBuildIndexIndex of the scene in the Build Settings to load.

◆ unloadScene() [2/2]

static void FYFY.GameObjectManager.unloadScene ( string sceneName)
static

Destroys all GameObjects associated with the given Scene and removes the Scene from the SceneManager.

Parameters
sceneNameName of the scene to load.

The documentation for this class was generated from the following file: