You’re just getting a nullref. Go fix it. You don’t need to post here because…
The answer is always the same… ALWAYS!
How to fix a NullReferenceException error
https://forum.unity.com/threads/how-to-fix-a-nullreferenceexception-error.1230297/
Three steps to success:
- Identify what is null ← any other action taken before this step is WASTED TIME
- Identify why it is null
- Fix that
After that, as others have pointed out, remember that photographs of code are NOT A THING.
If you post a code snippet, ALWAYS USE CODE TAGS:
How to use code tags: Using code tags properly
Also, making people guess “is this the correct format?” is also not useful.
Here is how to report technical problems to complete strangers on the internet:
How to report your problem productively in the Unity3D forums:
This is the bare minimum of information to report:
- what you want
- what you tried
- what you expected to happen
- what actually happened, log output, variable values, and especially any errors you see
- links to documentation you used to cross-check your work (CRITICAL!!!)
The purpose of YOU providing links is to make our job easier, while simultaneously showing us that you actually put effort into the process. If you haven’t put effort into finding the documentation, why should we bother putting effort into replying?