How to instantiate an object?

That is a PERFECT place to begin your next investigations. Here’s a sample of the thought process:

Step by step, break it down, find the problem.

The NullRef “problem” doesn’t actually change. It’s ALWAYS the same, no matter where it happens, in your code, in Unity’s code, in someone else’s code.

Therefore the answer really is ALWAYS the same. I’m not kidding. There’s never a NullRef that is fixed by any other way.