NullReferenceException: Object Reference not set to an instance of an object

For scripting questions, please post in the scripting forum. The 2D forum isn’t for general scripting questions. Your question is the most common question asked on this forum and is a basic C# thing; you have a reference that isn’t initialised. There’s a pinned post here: https://forum.unity.com/threads/how-to-fix-a-nullreferenceexception-error.1230297/

A good place to start is the Getting Started forum for initial questions too.

Also, please use code-tags when posting code rather than plain-text.

I’ll move your post for you.

Thanks.