Class ObjectCreationData
Used to create a game object in the editor and with a button
Namespace: UnityEditor.MARS
Syntax
public abstract class ObjectCreationData : ScriptableObject
Fields
m_Icon
Icon used for the object creation button
Declaration
protected DarkLightIconPair m_Icon
Field Value
Type | Description |
---|---|
DarkLightIconPair |
m_ObjectName
Name of the object being created
Declaration
protected string m_ObjectName
Field Value
Type | Description |
---|---|
String |
m_Tooltip
Tooltip for the object creation button
Declaration
protected string m_Tooltip
Field Value
Type | Description |
---|---|
String |
Properties
CreateInContextSelection
Scene context that the object will be created in
Declaration
public ObjectCreationData.CreateInContext CreateInContextSelection { get; }
Property Value
Type | Description |
---|---|
ObjectCreationData.CreateInContext |
ObjectGUIContent
Object creation button GUI content
Declaration
public GUIContent ObjectGUIContent { get; }
Property Value
Type | Description |
---|---|
GUIContent |
ObjectName
Name of the object being created
Declaration
public string ObjectName { get; }
Property Value
Type | Description |
---|---|
String |
Methods
CreateGameObject()
(Obsolete) Create a game object
Declaration
public virtual bool CreateGameObject()
Returns
Type | Description |
---|---|
Boolean |
CreateGameObject(out GameObject, Transform)
Create a game object from the creation data
Declaration
public abstract bool CreateGameObject(out GameObject createdObj, Transform parentTransform)
Parameters
Type | Name | Description |
---|---|---|
GameObject | createdObj | Newly created game object |
Transform | parentTransform | Parent transform for the newly created game object |
Returns
Type | Description |
---|---|
Boolean |
|
GenerateInitialGameObject(String, Transform)
Create an empty game object with a unique name at the parent transform with world scale applied
Declaration
protected GameObject GenerateInitialGameObject(string objName, Transform parent)
Parameters
Type | Name | Description |
---|---|---|
String | objName | Name of the object to apply unique version |
Transform | parent | Parent transform for the newly created game object |
Returns
Type | Description |
---|---|
GameObject | Newly created game object |
GetOrGenerateUniqueParent(String)
Get or create a new GameObject whose Transform be used as the parent for creating objects
Declaration
protected static Transform GetOrGenerateUniqueParent(string transformName)
Parameters
Type | Name | Description |
---|---|---|
String | transformName | The name to search for, or to be used for the new GameObject |
Returns
Type | Description |
---|---|
Transform | The new or existing Transform |