How to get a prefab and instantiate it in a script

dont say use public GameObject prefab; and then set it in the editor i need something that is only in the script also idk if im unsing it wrong but resouces.load wond work

Start with the docs on Resources.Load()

It has very specific steps and requirement and I will not be retyping them for you here.

Alternately look into Addressables, but those are VERY complicated.

I’m not sure about anyone else, but that’s exactly what I do. I setup a class to house all my prefabs, and then when needing them through code, I just simply reference that class and the particular prefab. Which can also be done in another prefab, mind you…

But if you’re bent on using a resources folder, then read this post:
https://discussions.unity.com/t/how-to-instantiate-prefab-with-resources-load/61785