Login Register
Everyday Commands: Managing Your Project

Create Commands for Making New Objects and Scripts

Estimated reading: 0 minutes 8 views

Create commands generate new content: GameObjects, primitives, prefab instances, scripts, materials, and assets. These are the commands you use most when building scenes.

Key commands:

  • object.create — Empty GameObject with optional parent and position.
  • object.create_primitive — Cube, Sphere, Capsule, Cylinder, Plane, or Quad with name, position, rotation.
  • object.instantiate — Spawns a prefab instance with optional overrides.
  • asset.create — Creates asset files. For scripts: provide path and content. For materials: color (hex or named), metallic (0-1), smoothness (0-1), shader_name, and assign_to for auto-assignment to a GameObject.

Material creation: Say “Create a shiny blue metal material for the Player” and Vex calls asset.create with color="#0066FF", metallic=0.9, smoothness=0.8, assign_to="Player". The .mat file is created and applied automatically.

Example — player character: You say “Create a player with physics.” Vex executes:

  1. object.create_primitive — Capsule named “Player”
  2. component.add — Rigidbody with freeze rotation
  3. asset.create — PlayerController.cs script

Done in seconds. Objects appear in your Unity Editor in real time.

Script creation:

The asset.create command creates script files with content you or Vex specify. Vex writes proper C# code with the correct namespace, class structure, and MonoBehaviour lifecycle methods. Scripts are created at the path you specify (or that Vex discovers using workspace.find). After creation, Unity detects the new file and recompiles — unless batch mode is active, in which case recompilation is deferred until all files are created.

Prefab instantiation:

The object.instantiate command spawns copies of existing prefabs into your scene. Point it at a prefab asset path and it creates an instance with optional name, position, and rotation overrides. This is faster than creating objects from scratch when you already have prefabs set up.

Primitive types:

object.create_primitive supports six shapes: Cube, Sphere, Capsule, Cylinder, Plane, and Quad. These are the building blocks for quick prototyping. Vex can create dozens of primitives in seconds to block out a level layout or build placeholder geometry while you design the real assets.

Batch creation:

When creating many scripts at once, Vex uses unity.batch_operation to freeze recompilation first. All scripts are created without triggering individual recompiles, then one single recompile processes everything at once. Ten scripts, one recompile instead of ten. This saves minutes during large feature builds.

Share this Doc

Create Commands for Making New Objects and Scripts

Or copy link

CONTENTS
Antimanual

Ask our AI support assistant your questions about our platform, features, and services.

You are offline
Chatbot Avatar
What can I help you with?