As the title says, I’m trying to call this function every x seconds
void stuff () {
treeenergy = treeenergy + Random.Range(1,25);
if (treeenergy >= 100)
Instantiate(Tree, new Vector3(x, 0, z), Quaternion.identity);
This is the whole code:
using UnityEngine;
using System.Collections;
public class Treestuff : MonoBehaviour {
public float treeenergy;
public float treeleaves;
public float leafsize;
public float treehieght;
public float x;
public float z;
GameObject Tree;
void Awake () {
treeenergy = 15;
treeleaves = Random.Range(1,100);
leafsize = Random.Range(1,100);
treehieght = Random.Range(1,100);
x = Random.Range(1,10);
z = Random.Range(1,10);
Tree = Resources.Load ("Tree") as GameObject;
}
// Use this for initialization
void Start () {
treeenergy = 15;
}
// Update is called once per frame
void Update () {
}
void stuff () {
treeenergy = treeenergy + Random.Range(1,25);
if (treeenergy >= 100)
Instantiate(Tree, new Vector3(x, 0, z), Quaternion.identity);
}
}
Ok, I'm not entirely sure what to do with this...
– Jared-3