spawning problem

I can't seam to get this script to work for spawning an enemy.

var evilsphere : Transform;

function Update ()
Instantiate (evilsphere,transform.Find("spawnpoint")transform.position,

Also I would like the enemy to be spawned randomly, how should I do that?

more ▼

asked Jul 15 '10 at 08:38 PM

Wesley gravatar image

25 10 11 13

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

If this is your script you probably get a syntax error because you're missing a dot between ("spawnpoint") and transform.position. Also instead of searching for the object named spawnpoint it would be a good idea to save a reference to the spawnpoint. (like you did for the prefab)

If you want to spawn at random position look into Random.insideUnitCircle.

more ▼

answered Jul 15 '10 at 09:48 PM

StephanK gravatar image

6.4k 46 59 101

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Jul 15 '10 at 08:38 PM

Seen: 828 times

Last Updated: Jul 15 '10 at 08:38 PM