Error CS0246

Hi, I have such a bug
what can I do?

Assets\Scripts\WaveConfigSO.cs(2,29): error CS0246: The type or namespace name ‘ScriptableObject’ could not be found (are you missing a using directive or an assembly reference?)

My Code:
[CreateAssetMenu(menuName = “Wave Config”, fileName = “New Wave Config”)]

public class WaveConfigSO : ScriptableObject

{

[SerializeField] List<GameObject> enemyPrefabs;

[SerializeField] Transform pathPrefab;

[SerializeField] float moveSpeed = 5f;

public int GetEnemyCount()

{

    return enemyPrefabs.Count;

}

public GameObject GetEnemyPrefab(int index)

{

    return enemyPrefabs[index];

}

public Transform GetStartingWaypoint()

{

    return pathPrefab.GetChild(0);

}

public List<Transform> GetWaypoints()

{

    List<Transform> waypoints = new List<Transform>();

    foreach(Transform child in pathPrefab)

    {

        waypoints.Add(child);

    }

    return waypoints;

}

public float GetMoveSpeed()

{

    return moveSpeed;

}

}

Hi,

Have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture? Are there namespaces at the top of your script?


See also:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms