Writing Instantiate Code

Hi all!

I am new to coding, and i am writing a custom class for a menu.

I would like to write an instantiate code from the ground up(or ref other code) to add a prefab to my scene. Since it is a custom class that does not derive from anything, i cannot simply use the Instantiate function(as far as i know).

I’m not sure if i am going about this in a good way, so any help will be greatly appreciated. Thank you in advance.

Yes you can. Just call GameObject.Instantiate instead. You’ll need a reference on a GameObject to instiante though. As you can’t do tht with the editor, an other class (inheriting from MonoBehaviour that one, a usual one) will need to do that job, or use a Find method to get a GameObject from the scene, or Resources.Load to get a prefab from the assets folder.