🤔

CS0102#

The type 'Foo' already contains a definition for 'Bar'

This error is shown when there are conflicting types in the same type.

Resolution#

Don't reuse names in a type.

This might be caused by declaring a subtype of the same name as a member:

public class Example : MonoBehaviour
{
    public class Data
    {
        ...
    }
    
    // 🔴 Incorrect. Data is already declared above, you cannot declare a member called Data.
    public Data Data { get; private set; }
}

Or it might be caused by declaring two members with the same name:

public class Example : MonoBehaviour
{
    public float Speed;
    // 🔴 Incorrect. Speed is already declared above, you cannot declare a member called Speed.
    public float Speed;
}