Quantcast
Channel: Questions in topic: "choose"
Viewing all articles
Browse latest Browse all 81

Random selection

$
0
0
Hey guys, i know that this question had already been asked, but i didn't understood what you are supposed to do and what i've tried didn't work really well. I would like to know how do you create a script that basically makes random decisions, selecting one of the available variables. I really wanted to know this, because i can imagine a lot of things i could use, such as: Make AI decide places to go, and things to do while doing other things, randomly spawning things, randomizing the game, switch between scenes, etc... I want to make something like this: using UnityEngine; using System.Collections; public class TEST : MonoBehaviour { public GameObject cube; public GameObject triangle; public GameObject sphere; void Update() { //Do script things here this.gameObject.select between cube,triangle or sphere; //Do something else, such as follow the gameobject of the variable, change something, ... } } Thanks for the help!

Viewing all articles
Browse latest Browse all 81

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>