How to spawn object with button UI

PLS HELP ME IM NEW,Guys im new into unity pls help me i want to UI button spawn object at position i want pls help me

Hello @starabarc2
In your Button component, in the OnClick event you can point to a function, you have here a good tutorial to learn about call functions in Buttons: Unity Button Click Events C# Script Tutorial - YouTube

You need to write a function with this look to instantiate a object in runtime when you click the button:

    void InstantiateNewObject()
    {
        GameObject cube = new GameObject("MyNewItem");

        Instantiate(cube, new Vector3(0f, 0f, 0f), Quaternion.identity);
    }

199300-obraz-2022-08-29-120136907.png

i cant see InstantiateNewObject