Class ObjectCreationData
Used to create a game object in the editor and with a button
Inherited Members
Namespace: UnityEditor.MARS
Assembly: Unity.MARS.Editor.dll
Syntax
[Serializable]
[MovedFrom("Unity.MARS")]
public abstract class ObjectCreationData : ScriptableObject
Fields
m_Icon
Icon used for the object creation button
Declaration
[SerializeField]
[Tooltip("Icon used for the object creation button")]
protected DarkLightIconPair m_Icon
Field Value
Type | Description |
---|---|
DarkLightIconPair |
m_ObjectName
Name of the object being created
Declaration
[FormerlySerializedAs("m_ButtonName")]
[SerializeField]
[Tooltip("Name of the object being created")]
protected string m_ObjectName
Field Value
Type | Description |
---|---|
string |
m_Tooltip
Tooltip for the object creation button
Declaration
[SerializeField]
[Tooltip("Tooltip for the object creation button")]
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
[Obsolete("CreateGameObject() has been deprecated. Use CreateGameObject(out GameObject createdObj, Transform parentTransform) instead.", false)]
public virtual bool CreateGameObject()
Returns
Type | Description |
---|---|
bool |
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 |
---|---|
bool |
|
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 |