Error while referencing GameObject

Hi guys,

I’m very new to Unity and I’m trying to use splines to move the player around, like it’s on rails. To do this, I have created many different splines, with the intention of changing which spline the player is following.

I’ve created a script with the intention of making it change the spline. What I have right now is my first attempt. Here is what I’ve got:

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

public class buttonScript : MonoBehaviour
{
    public GameObject playerCube;
    SplineContainer currentSpline;
}

I’ve tried to follow a few tutorials on changing - or even referencing - other object’s components, but have had no luck. It always has this error:

The type or namespace name ‘SplineContainer’ could not be found (are you missing a using directive or an assembly reference?)

Do you have any idea what could be wrong? Any ideas are appreciated.

I think you need to add this to the top of the file so that the compiler knows what “SplineContainer” is.

using UnityEngine.Splines