Zombie Spawn Points

Hello

I thought I would share a view of my map with my Spawn Points placed within the map.

The spawn script spawns X copies of a zombie or skeleton prefab within Y range of the transform position.

I am using the following to visualize the spawn areas

 private void OnDrawGizmos()
    {
        Gizmos.DrawCube(transform.position, new Vector3(warpSpace,1,warpSpace));
    }

An issue I struggled with initially was the zombies would spawn OK but not properly “attach” to the NavMesh in the area and as a result just randomly move to a new (undesired) location on the map. I was pulling my hair out until I discovered the .WARP function which moves a NavMeshAgent to a specific position but also correctly repositions them on the mesh so they act as intended.

> o.transform.GetComponent<NavMeshAgent>().Warp(gameObject.transform.position + new Vector3(Random.Range(-warpSpace, warpSpace), 0, Random.Range(-warpSpace, warpSpace)));

Geoff

Privacy & Terms