C# script for moving platforms in a 2D Unity game, code is not making the correct menu for an array in the inspector

124 Views Asked by At

I am a beginner game creator in Unity 2D, I am following this tutorial by Coding in Flow:

https://www.youtube.com/watch?v=UlEE6wjWuCY&list=PLrnPJCHvNZuCVTz6lvhR81nnaf1a-b67U&index=10

(I am having a problem at 11:37 in the video)

My C# script for moving platforms called "Waypoint Follower" is in Moving platform game object, but unlike in the video, the serialized field for the drop down menu is not an array allowing me to drag and drop waypoints, instead it is making a drop down menu called "size" and wants a number input. My code is identical to the script in the video, but it is not having the same results in Unity when I am viewing the Waypoint Follower script in the inspector.

Here is what mine looks like:

My Image

Here is what it is supposed to look like:

Coding in Flow's Image

Why is there no list???

I will love you forever if you can fix this

Also, here is my code in case it's not the same and I'm being stupid:

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

public class WaypointFollower : MonoBehaviour
{
    [SerializeField] private GameObject[] waypoints;

    private void Update()
    {
        
    }
}
1

There are 1 best solutions below

0
shiptoast On

Was a version issue probably, I got it working by just dragging and dropping the waypoints into the script in the inspector and it made a list.