Question by
robomcfobo · Jun 20, 2016 at 12:38 PM ·
randomrandom.rangerangefloats
the floats wont be applied, Random.Range
{
float timeLeft;
void start ()
{
timeLeft = Random.Range(5.0f, 10.0f);
}
void Update()
{
if (gameObject.GetComponent<Rigidbody>().isKinematic == false)
{
timeLeft -= Time.deltaTime;
if (timeLeft < 0)
{
Destroy(gameObject);
}
}
}
}
why wont the floats be applied to the timeLeft?
Comment
Best Answer
Answer by gjf · Jun 19, 2016 at 10:09 PM
if you want unity to call a method to set timeLeft
, try using the proper name...
start()
is not the same as Start()