Search Unity

'WaveManager' does not create a definition for 'ContinueSpawning'...

Discussion in 'Editor & General Support' started by Brian-Washechek, Jun 6, 2020.

  1. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    I'm puzzled by this screen:
    6-05-2020 - 2.png
    I have no idea what to make of it. Any help? Am I missing a assembly reference a directive?
    (I'm pretending to know what it means by that.)
     
  2. Please include your code in [ CODE ] tag on the forums. As it is described here: https://forum.unity.com/threads/using-code-tags-properly.134625/
    Your extra wide screenshots are a pain in the butt to read.
    Please always include the script which contains the error itself. In this case it is the GameManager.cs. Your screenshot contains two WaveManager.cs?
     
  3. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    I apologize.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using System.Security.Cryptography;
    4. using UnityEngine;
    5.  
    6. public class WaveManager : MonoBehaviour
    7. {
    8.     public static WaveManager instance;
    9.  
    10.     public WaveObject[] waves;
    11.  
    12.     public int currentWave;
    13.  
    14.     public float timeToNextWave;
    15.  
    16.     public bool canSpawnWaves;
    17.  
    18.     private void Awake()
    19.     {
    20.         instance = this;
    21.     }
    22.  
    23.     // Start is called before the first frame update
    24.     void Start()
    25.     {
    26.         timeToNextWave = waves[0].timeToSpawn;
    27.     }
    28.  
    29.     // Update is called once per frame
    30.     void Update()
    31.     {
    32.         if (canSpawnWaves)
    33.         {
    34.             timeToNextWave -= Time.deltaTime;
    35.             if (timeToNextWave <= 0)
    36.             {
    37.                 Instantiate(waves[currentWave].theWave, transform.position, transform.rotation);
    38.  
    39.                 if (currentWave < waves.Length - 1)
    40.                 {
    41.                     currentWave++;
    42.  
    43.                     timeToNextWave = waves[currentWave].timeToSpawn;
    44.                 }else{
    45.                     canSpawnWaves = false;
    46.                 }
    47.             }
    48.         }
    49.     }
    50.  
    51.     public void ContinueSpawning()
    52.     {
    53.         if (currentWave < waves.Length - 1 && timeToNextWave > 0)
    54.         {
    55.             canaSpawnWaves = true;
    56.         }
    57.     }
    58. }
    59.  
    60. [code=CSharp][System.Serializable]
    61. public class WaveObject
    62. {
    63.     public float timeToSpawn;
    64.     public EnemyWave theWave;
    65. }
    66.  
    And here's GameManager.cs:
    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class GameManager : MonoBehaviour
    7. {
    8.     public static GameManager instance;
    9.  
    10.     public int currentLives = 3;
    11.  
    12.     public float respawnTime =2f;
    13.  
    14.     private void Awake()
    15.     {
    16.         instance = this;
    17.     }
    18.  
    19.     public void KillPlayer()
    20.     {
    21.         currentLives--;
    22.  
    23.         if(currentLives > 0)
    24.         {
    25.             //respawn code
    26.             StartCoroutine(RespawnCo());
    27.         }else{
    28.             //you dead, partna
    29.         }
    30.     }
    31.  
    32.     public IEnumerator RespawnCo()
    33.     {
    34.         yield return new WaitForSeconds(respawnTime);
    35.         //respawn player
    36.         HealthManager.instance.Respawn();
    37.  
    38.         //WaveManager.instance.canSpawnWaves = true;
    39.         WaveManager.instance.ContinueSpawing();
    40.     }
    41. }
    And this is an image.
    6-05-2020 - 3.png
    Sorry. It's been a little bit...
     
    Last edited: Jun 6, 2020
  4. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    Assets\Scripts\GameManager.cs(38,30): error CS1061: 'WaveManager' does not contain a definition for 'ContinueSpawing' and no accessible extension method 'ContinueSpawing' accepting a first argument of type 'WaveManager' could be found (are you missing a using directive or an assembly reference?

    Well am I?
     
  5. ContinueSpawing vs. ContinueSpawning

    Seriously, look at the error message it says which line contains the error. It says what is the problem. Literally.
     
  6. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    Thank you. God, I'm an idiot