Hey, I'm currently creating a game there I need a Prefab to spawn on the right spot over and over again... I put something togheter and got it to spawn over and over again but now on the right spot - Only random on the map... if it isn't to much to ask could someone provide me with a simple script there the Prefab spawns like every 5 second and on the right spot ( so I add the script to a "GameObject" and the Prefab will spawn there ).
I would be really greatfull if someone could do this.
looks like you dont understand so lets try explain it.
1st of all it's two question your asking:- How to spawn in the right location and How to spawn an object every (x) seconds
All you need for the 1st part of your question is here in the instantiate script reference. Right at the top it says
Object.Instantiate
static function
Instantiate (original : Object,
position : Vector3, rotation :
Quaternion) : Object
these are the parametres which you can specify for this function. So when you use instantiate you need to specify
//The function The gameObject THE SPAWNS LOCATION the spawns direction
Instantiate (Prefab, transform.position, transform.rotation);
using transform.position and transform.rotation means the gameobject/prefab will spawn in the location and direction of the object that the script is attached to. You can copy OrangeLightenings code because it looks right but you need to understand what it's doing otherwise your never going to learn and you will just be making a hobby out of pilfering internet scripts.
Yeah, I made a mistake, but I fixed that now. Script updated try it out :)
– FLASHDENMARK