Getting "ArgumentNullException: Value cannot be null" error

I am getting this error when i add the code:

GetComponent().PlayOneShot(crashSFX);

1 Like

it is saying that you don’t have an AudioSource component on the object so can you don’t check that in the editor and hierarchy?

1 Like

I think you’ll find that crashSfx is null. You’ll need to set it in the inspector.

1 Like

Privacy & Terms