Hi Everybody,
I am still in the trial period of Unity, but am having so much fun with it I’ll be purchasing it for sure!
I’ve never done any programming before this, so I have a lot of questions about the scripting. So far I’ve been able to get quite a few things happening in my little game I’m making, but have hit a few stumbling blocks I could use help with. I am a professional sound designer, so perhaps if someone has general sound design questions I could be usefull that way and reciprocate if someone can give me a few tips with the scripts.
I have a script to instantiate a sphere every few seconds from an empty game object. The sphere then flys toward the camera. This is working fine, but I would like to make several spheres that get randomly selected, so sometimes sphere 1 comes out, sometimes sphere 2, etc. Also, I would like the timing to vary so its not just every 3 seconds, but between 3-10 seconds. Here is what I am using now:
var newObject: GameObject;
function Start() {
while (true) {
yield WaitForSeconds(3);
Instantiate(newObject, transform.position, transform.rotation);
}
}
I know this is probably simple to do, but I am still trying to get a grasp on programming, so if anyone could give me some tips that would be great.
Thanks!
Matt