Hello everyone,
I’m really going nuts over this, I have spent hours trying to fix it. At this point, it seems that I have one problematic script, a singleton base class that I basically stole from a unity course :
using UnityEngine;
public class Singleton<T> : MonoBehaviour where T : Singleton<T>
{
private static T instance;
public static T Instance
{
get { return instance; }
}
public static bool IsInitialized
{
get { return instance != null; }
}
protected void Awake()
{
if (instance != null)
{
Debug.LogError("[Singleton] Trying to instantiate a second singleton");
Destroy(gameObject);
}
else
instance = (T)this;
}
protected void OnDestroy()
{
if (instance == this)
instance = null;
}
}
The class seems to work and I use it with derived classes, but I still get the “No MonoBehaviour scripts in the file, or their name doesn’t match the file name”, and I really don’t get the problem.
Another issue with the project is that when I import assets that work fine on other projects, the scripts just don’t get used, I get a “The associated script cannot be loaded” error on the objects. I’ve read tens of forum posts and can’t seem to get a solution… I think the two are linked but I can’t be sure.
I don’t have any console errors apart from
“GetLoadedImportedAssetsAndTargetHashes called with invalid targetHash”
“Assertion failed on expression: ‘it->second.IsValid()’”, which from my research is linked to hdrp pipeline and not related…
Any idea, something wrong with the code, with the project ?