Assets/Scripts/SpawnsManager.cs(37,19): error CS1061: Type `UnityEngine.GameObject' does not contain a definition for `currentTime' and no extension method `currentTime' of type `UnityEngine.GameObject' could be found. RRS feed

  • Question

  • using UnityEngine;
    using System.Collections;
    using UnityEngine.UI;
    public class SpawnsManager : MonoBehaviour
        public GameObject granny;
        public int spawns;
        public Transform[] spawn;
        public Transform chosenSpawnObj;
        public float waitTimer;
        public static float _waitTimer;
        public float FoodPercent;
        public static bool spawnFood;    //set value in here 
        public static float spawnTimer;  //set value in here 
        public static int chosenSpawn;
        public GameObject[] food;
        public GameObject Pill;
        public void Start()
            spawn = new Transform[16];
            spawns = this.transform.childCount;
            for (int i = 0; i < spawns; i++)
                spawn[i] = this.transform.GetChild(i);
            _waitTimer = waitTimer;
        public void Update()
            if(granny.currentTime > 0)
                if(_waitTimer > 0)
                    _waitTimer -= 1 * Time.deltaTime;
            public void Spawn()
            chosenSpawn = Random.Range(0, spawns);
            chosenSpawnObj = spawn[chosenSpawn];
            //randomly calculate if it ll be a Food or not 
            if (Random.value > FoodPercent)
                spawnFood = true;
            //spawn Pill
            Vector3 pos = new Vector3(chosenSpawnObj.position.x, chosenSpawnObj.position.y - 1.5f, chosenSpawnObj.position.z);
            if (spawnFood)
                Instantiate(food[Random.Range(0, food.Length)]);
                Instantiate(Pill, pos, Quaternion.identity);
            //set finalized results and make it loop 
            spawnFood = false;
            _waitTimer = waitTimer;

    • Moved by CoolDadTx Thursday, May 17, 2018 3:25 PM Third party product
    Thursday, May 17, 2018 12:09 PM

All replies

  • Please post questions related to Unit in the Unity forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, May 17, 2018 3:25 PM