- Home /
Unity not recognizing my scripts
Hello, I'm working on a 3d multiplayer game on unity and for some reason unity doesn't seems to want to recognize my scripts anymore when I connect to a local server. I get the following errors for every single script in my scene:
The referenced script (Script_name) on this Behaviour is missing!
Here is an exemple of one of the basic scripts i have:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Target : MonoBehaviour
{
private float hp = 20f;
//Author: Hugo Locatelli
public void TakeDmg(float dmg)
{
hp -= dmg;
Debug.Log(hp);
if (hp <= 0f)
Die();
}
//Author: Hugo Locatelli
void Die()
{Destroy(gameObject);}
}
I really hope someone can help me with this, I'm starting to loose my mind here.
Is that the ONLY error? Unity will sometimes complain about perfectly good scripts if there are other errors and you'll only see the real status if you fix all of them.
If that's not the case, try pasting it into a new file - Unity doesn't like unprintable characters which occasionally creep in. Bizarre, but it happens!
i had the same problem and managed to fix it by removing the .cs.meta files