[ad_1]
I am fairly new to C#/Unity. I am getting this error:
CS1929:
MonoBehaviour
doesn’t include a definition of.OfType<>()
.
If I perceive proper, Systeme.Linq
not acknowledge this operate. What have I achieved fallacious on this code?
DataPersitenceManager.cs
utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;
utilizing System.Linq;
public class DataPersistenceManager : MonoBehaviour
{
non-public Checklist<IDataPersistence> findAllDataPersistenceObjects()
{
IEnumerable<IDataPersistence> dataPersistenceObjects = FindObjectOfType<MonoBehaviour>().OfType<IDataPersistence>();
return new Checklist<IDataPersistence>(dataPersistenceObjects);
}
}
IDataPersistence.cs
utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;
public interface IDataPersistence
{
void loadData(gameData knowledge);
void saveData(ref gameData knowledge);
}
gameData.cs
utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;
[System.Serializable]
public class gameData
{
}
[ad_2]