I'm Trying to Make a Cursor for my Menu

174585-galv-animated-cursor-image-zpsjxaohhk7.gif

This is an example of what I’m trying to make, except mine won’t be animated. The code I’m working with so far looks like this.

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


public class MenuControl : MonoBehaviour
{
    // Start is called before the first frame update
    
    GameObject flowerPrefab = flower_icon.prefab;
    Vector3[] iconPositions = new [] { new Vector3(30f,-9.9f,0f), new Vector3(9.7f,-6.1794f,0f), new Vector3(49f, -8.6f,0f) };

    public void Start()
    {
        
       
    }

    // Update is called once per frame
    public void Update()
    {
        if(yourUpButtonPressed)
        {
            int iconPositionsIndex = 0;
            iconPositionsIndex++; 
            iconPositionsIndex = iconPositionsIndex % iconPositions.Length;
            iconPositions.transform.position = iconPositions[iconPositionsIndex];
        }

        if(yourDownButtonPressed)
        {
            int iconPositionsIndex = 0;
            iconPositionsIndex--; 
            iconPositionsIndex = iconPositionsIndex % iconPositions.Length;
            iconPositions.transform.position = iconPositions[iconPositionsIndex];
        }
        
    }

}

And the errors I’m getting are

I’m not new to C# but I’m very new to how Unity works and especially how its UI works. I found example code like this online on StackOverFlow but it went wrong and I’m wondering if you guys know of a way I can work with what I have right now.

First : Instead of doing this : GameObject flowerPrefab = flower_icon.prefab;
You should just write public GameObject flowerIcon and reference it in the editor.

Second: You haven’t created or defined anything that is called “yourUpButtonPressed”
If you want this to be useable with a controller I suggest this tutorial on controller input: CONTROLLER INPUT in Unity! - YouTube

Third: A Vector3 is written like this: Vector3 yourVector3 = new Vector3(x , y , z);
Also, Vector3’s do not have transforms. Only gameObjects have that property.

Fourth: Pretty much the same as the second one.

Fifth: Same error as third.

Hope this helped!

Also, just as a reminder, Unity c# is pretty different from normal c#. I suggest watching some videos about it.