Create Empty Game Object#
Game Object / Creation / Create Empty Game Object
Description#
Creates an empty game object
Parameters#
| Name | Description |
|---|---|
| Name | The name for the new game object |
| Set | Where the game object reference is optionally stored |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Create Empty Game Object")]
[Image(typeof(IconCubeOutline), ColorTheme.Type.TextLight)]
[Description("Creates an empty game object")]
[Category("Game Object/Creation/Create Empty")]
[Parameter("Name", "The name for the new game object")]
[Parameter("Set", "Where the game object reference is optionally stored")]
[Serializable]
public class InstructionCoreGameObjectCreateEmpty : Instruction
{
[SerializeField] private GetString m_Name = new GetString();
[SerializeField] private SetGameObject m_Set = new SetGameObject(new TypeGameObjectNoneSet());
protected override string GetTitle(GameObject source) => $"{this.m_Set} = Create Empty";
protected override Awaitable Run(Args args)
{
string name = this.m_Name.Get(args);
GameObject gameObject = new GameObject(name);
this.m_Set.Set(gameObject, args);
return Done;
}
}
}