I was planning on making an SCP game with unity, and i’m really new to the engine, so would someone be able to tell me how to make a face pop up onto my screen randomly with Math.Range()?
(PS. I couldn’t find an answer to this question anywhere)
I was planning on making an SCP game with unity, and i’m really new to the engine, so would someone be able to tell me how to make a face pop up onto my screen randomly with Math.Range()?
(PS. I couldn’t find an answer to this question anywhere)
Do you mean Random.Range?
This is useful if you want to create a random number - in this case that could be used to set a random amount of time before the face/texture is shown.
Step by step:
The script could look like this (javascript):
var timer : float = 0;
var counter : float = 0;
var FaceTexture : GUITexture;
function Start() {
//set random time
timer = Random.Range(5.0, 10.0);
}
fucntion Update() {
//make counter count up by adding time that past since last frame
counter += Time.deltaTime;
if(counter >= timer)
{
//show face texture
FaceTexture.enabled = true;
}
}