OnTriggerEnter ignores any values set after initialization

First fix the nullref.

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

In the future if you post code, please ALWAYS USE CODE TAGS:

How to use code tags: Using code tags properly