Object Spawner

Tool for placing objects into the scene.

This is an example of a custom tool for Unity. It provides an efficient interface for adding objects to a scene. It could be expanded on to handle more tasks and save time during production.

  • Streamlines the spawning game objects during game production/level design.
  • Simplifies repetitive, time-consuming tasks
  • Provides the ability to spawn objects as children of existing game objects
  • Centralizes the naming convention of the objects name and id
  • Simplifies the scaling of spawned objects
  • Allows better control to specify an area in the map to spawn the objects
  • Provides helpful feedback if the user makes an error

Video Demonstration:



Screenshot:





Code Sample:

    private void SpawnObject()                      
    {                                
        Vector2 spawnCircle = Random.insideUnitCircle * spawnRadius;
        Vector3 spawnPos = new Vector3(spawnCircle.x, 0f, spawnCircle.y);
        objectScale = Random.Range(minScaleVal, maxScaleVal);
        
        string objName = objectBaseName;
        
        if(appendID)
            {
                objName += objectID.ToString();
                objectID++;
            }
            
        GameObject newObject = Instantiate(objectToSpawn, spawnPos, Quaternion.identity, objectContainer);
        newObject.name = objName;
        newObject.transform.localScale = Vector3.one * objectScale;
    }