I have a problem with a game I am programming in unity. This specificaly occured when i added the script given below. the error message says that no monobehaviorscripts in the file, or their names do not match the file name. This script is meant to spawn the eniemies in the game.
I have already tried changing the class name, file name and copy the one into the other. but this does not seem to help.
screenshot unity of error message and code
i just edited my code and it does not seem to be solved.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class wavesystem : MonoBehaviour
{
public int enimicount;
public int[] enimi = { 1 };
public int wave = 1;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (enimicount = 0)
{
int threat = 0;
for (threat < wavesystem.wave)
{
int name = Random.Range(0, wavesystem.enimi.Length);
int enimitreat = wavesystem.enimi[name];
if (threat + enimitreat <= wave)
{
float xpos = Random.Range(0, 2);
Instantiate("enimie" + name, (xpos, 1));
wavesystem.enimicount = wavesystem.enimicount + 1;
threat = threat + enimitreat;
}
}
wavesystem.wave = wavesystem.wave + 1;
}
}
}