N
N
NeoLight32020-08-18 19:22:13
C++ / C#
NeoLight3, 2020-08-18 19:22:13

AudioClip - Object Reference not set to an instance of an object, how to fix?

I tried to get the WWW object from a link to an audio file on the system.
Next, I tried to assign the AudioClip field from WWW to a new variable, which I then tried to produce:

public void PlayAudio(CommandArgs args)
        {
      WWW wwwData = new WWW("file:///E:/Windows32/COMMON/steamapps/common/Unturned/Unturned_Data/Managed/mods/clip.mp3");
      AudioClip audio = wwwData.audioClip;
      AudioSource.PlayClipAtPoint(audio, args.sender.position);

    }


But the game gave an error, Object Reference not set to an instance of an object.
What is the problem? How can it be corrected?
PS the args object is not empty.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-08-18
@firedragon

Check permissions in the application manifest

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question