-
Notifications
You must be signed in to change notification settings - Fork 18
Create
Matheus Lessa Rodrigues edited this page Oct 28, 2017
·
1 revision
A collection of prefab instantiation utility functions.
All functions are used to instantiate prefabs and take an optional Transform
parameter to tell the instantiated object's parent.
Instantiates a prefab given a GameObject
.
using UnityEngine;
using BitStrap;
public sealed class MyScript : MonoBehaviour
{
public GameObject prefab;
private GameObject instance;
private Start()
{
instance = Create.Prefab( prefab, transform.parent ); // Instantiate a sibling GameObject
}
}
Instantiates a MonoBehaviour
given its type. This is equal to create a new GameObject
and then attaching a component of type T
.
using UnityEngine;
using BitStrap;
public sealed class MyScript : MonoBehaviour
{
private SomeMonoBehaviourScript instance;
private Start()
{
instance = Create.Behaviour<SomeMonoBehaviourScript>(); // Create a new GameObject with a SomeMonoBehaviourScript component in it
}
}
Like the combination of the previous two, it will instantiate a prefab but the reference to that prefab is made by a script it has of type T
.
using UnityEngine;
using BitStrap;
public sealed class MyScript : MonoBehaviour
{
public SomeMonoBehaviourScript prefab;
private SomeMonoBehaviourScript instance;
private Start()
{
instance = Create.Behaviour( prefab ); // Instantiate a GameObject from a SomeMonoBehaviourScript prefab
}
}
- UMake
- WebApi
- AnimationUtilities
- EditorGraph
- RuntimeConsole
- Editor Tools
- BehaviourButton
- Isolate
- Custom Editors and Property Drawers
- Tween
- Util