Ended up with Complier Error while working through tutorials

I don’t know if Unity has updated its system but while working through the tutorial (specifically Lesson 1.3 - High Speed chase Step 4), I ended up with a complier error . The error message pointed to a CS0104 error regrading the Vector3 variable.

Here’s the code instructed:

public class FollowPlayer : MonoBehaviour
{
    public GameObject player;
    private Vector3 offset = new Vector3(0, 5, -7);

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        transform.position = player.transform.position + offset;
    }
}

The issue here is that the error code said ‘Vector3’ is an ambiguous reference between ‘UnityEngine.Vector3’ and ‘System.Numerics.Vector3’

How do I fixed this? I can’t move onto the next step without resolving this one.

The top of most C# files includes using directives. Your code likely includes using System.Numerics; which is not commonly applicable in the context of Unity. It was probably added by your IDE automatically if you did not add it yourself. You should remove this line from your code, and in the future be wary of IDE autocompletion.

1 Like

Sorry, I forgot to mention the top part of the code which includes the following:

using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using UnityEngine;

I’m very new at C# so I wouldn’t have the foggiest as to how to change the code.

Based on what they said, just remove the using System.Numerics; line.