Twoorb Plugins  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Twoorb.PrefabSystem.PrefabConnection Class Reference

Represents a prefab connection to be used in your scripts. Use this class in all your scripts instead of a GameObject reference when you want to use a prefab. More...

Public Member Functions

 PrefabConnection ()
 Creates a new empty prefab connection More...
 
 PrefabConnection (GameObject prefab)
 Creates a new prefab connection with a prefab object. Make sure the prefab has a PrefabIdentifier script attached to it. More...
 
void GetGameObject< T > (Action< T > onObjectInitialized, Action< bool > onDone=null)
 Gets an instantiated object from the prefab service. Will use the prefab if used inside the editor More...
 
void ReleaseGameObject (Component obj, Action< bool > onDone=null)
 Releases/returns the instantiated gameobject to the prefab. GameObject.Destroy() will be used inside the Unity Editor. More...
 
bool PrepareForBuild ()
 Will prepare this script for builds. Only Use this if you know what you are doing More...
 

Public Attributes

GameObject m_prefab = null
 The prefab to reference. Need to have a PrefabIdentifier attached to it. More...
 

Properties

string PrefabID [get, set]
 The unique id of the prefab More...
 

Detailed Description

Represents a prefab connection to be used in your scripts. Use this class in all your scripts instead of a GameObject reference when you want to use a prefab.

Constructor & Destructor Documentation

Twoorb.PrefabSystem.PrefabConnection.PrefabConnection ( )

Creates a new empty prefab connection

Twoorb.PrefabSystem.PrefabConnection.PrefabConnection ( GameObject  prefab)

Creates a new prefab connection with a prefab object. Make sure the prefab has a PrefabIdentifier script attached to it.

Member Function Documentation

void Twoorb.PrefabSystem.PrefabConnection.GetGameObject< T > ( Action< T >  onObjectInitialized,
Action< bool >  onDone = null 
)

Gets an instantiated object from the prefab service. Will use the prefab if used inside the editor

Template Parameters
TThe component type to get back. The prefab connected to this class need to have this attached
Parameters
onObjectInitializedCallbak returning the instantiated object. Will be null upon failure. Remember to use ReleaseGameObject() when you are done with it.
onDoneCallback when the operation is complete
Type Constraints
T :Component 
bool Twoorb.PrefabSystem.PrefabConnection.PrepareForBuild ( )

Will prepare this script for builds. Only Use this if you know what you are doing

void Twoorb.PrefabSystem.PrefabConnection.ReleaseGameObject ( Component  obj,
Action< bool >  onDone = null 
)

Releases/returns the instantiated gameobject to the prefab. GameObject.Destroy() will be used inside the Unity Editor.

Parameters
objThe object to release.
onDoneCallback returning the success/failure of the operation

Member Data Documentation

GameObject Twoorb.PrefabSystem.PrefabConnection.m_prefab = null

The prefab to reference. Need to have a PrefabIdentifier attached to it.

Property Documentation

string Twoorb.PrefabSystem.PrefabConnection.PrefabID
getset

The unique id of the prefab


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