Ok so I followed a tutorial on how to spawn enemies and instantiating them, BUT the way it works is: I create an empty game object to attach my spawn script to, then I give the spawn points coordinates (inside the script). If I need another spawn point I need to create another script and name it something else… What I am trying to do is just keep it to 1 script if I have multiple places for enemies to spawn. So if you understood I am trying to make my script automatically pick up my gameobjects coordinates automatically (so the script is affected by the object its attached to…) is this possible or do I need to keep on creating spawnpointscriptA spawnpointscriptB etc?
Also…
I know I am asking for a lot but this is things I have no knowledge of and I need help:$ So on a side note I know you can call random… so if I have 3 different objects and want to spawn them randomly how do I do that? so for example atm I am spawning a car, I want to be able to spawn either a car a motorbike or a van (do not care about the probability if its equal chance should be okay:)).
I hope you guys understand what I am trying to achieve:o
Here is my script
#pragma strict
var cube : GameObject;
var spawn_position;
var timer = 0.0;
function spawn_cube ()
{
spawn_position = Vector3(16.5,9.4,-139);
var temp_spawn_cube = Instantiate(cube, spawn_position, Quaternion.identity);
}
function Start ()
{
}
function Update ()
{
timer += Time.deltaTime;
if(timer>6)
{
spawn_cube();
timer = 0.0;
}
}
Sorry for being an A-hole but there is 1 thing I couldnt fix and it came up when I started using instantiate. my models appear the wrong way around. The objects I spawn are prefabs of 3d car models, so when my car spawns depending on the model I download I might get a car coming in reverse or sideways or correctly… I tried to rotate the model I tried rotating in script but nothing seems to change this:O
Any help on any of the above problems is very well appreciated thank you so much:)