#System.MissingMethodException: Method not found

1 messages · Page 1 of 1 (latest)

tender surge
#

What I found online says that the below code should work, even tho I'm on Unity 2022. But I get "System.MissingMethodException: Method not found: 'Void UnityEngine.Networking.DownloadHandlerAudioClip..ctor(System.String, UnityEngine.AudioType)' "

private static IEnumerator StartPlay(string path, float volume = 1f, float pitch = 1f)
    {
        var www = UnityWebRequestMultimedia.GetAudioClip($"file://{path}", AudioType.WAV);
        yield return www.SendWebRequest();

        AudioClip audioClip;
        if (audioCache.ContainsKey(path))
            audioClip = audioCache[path];

        else
            if (www.result == UnityWebRequest.Result.Success)
            {
                audioClip = DownloadHandlerAudioClip.GetContent(www);
                audioCache[path] = audioClip;
            }
            else
            {
                Logger.Error($"Failed to load audio clip: {www.error}", "CustomSounds.LoadAudioClip");
                yield break;
            }

        if (audioClip != null)
        {
            var source = SoundManager.Instance.PlaySoundImmediate(audioClip, false, volume, pitch);
            UnityEngine.Object.Destroy(source, audioClip.length + 0.1f);
        }
    }
copper vigil
#

Can you show the full stack trace?

tender surge
#
System.MissingMethodException: Method not found: 'Void UnityEngine.Networking.DownloadHandlerAudioClip..ctor(System.String, UnityEngine.AudioType)'.
   at UnityEngine.Networking.UnityWebRequestMultimedia.GetAudioClip(String uri, AudioType audioType)
   at TOHE.Modules.CustomSoundsManager.StartPlay(String path, Single volume, Single pitch)+MoveNext()
   at Trampoline_ByteThisBepInEx.Unity.IL2CPP.Utils.Collections.Il2CppManagedEnumeratorMoveNext(IntPtr , Il2CppMethodInfo* )

UnityWebRequestMultimedia.GetAudioClip and DownloadHandlerAudioClip.GetContent are the only two the could be the issue, but I'm leaning towards the latter.

tender surge
#

CustomSoundsManager is the file throwing it

copper vigil
#

well the stack trace clearly says it's when you are calling GetAudioClip

#

It kind of seems like... maybe somehow UnityEngine.Networking.DownloadHandlerAudioClip..ctor(System.String, UnityEngine.AudioType) is getting stripped by IL2CPP?

tawny osprey
#

I presume this is happening in a build?

tender surge
#

only once the code is run

#

inspecting DownloadHandlerAudioClip.GetContent shows me this

public static AudioClip GetContent(UnityWebRequest www)
    {
        throw new System.NotSupportedException("Method unstripping failed");
    }
tawny osprey
#

it's weird that this method would get eaten

#

you aren't doing some weird reflection nonsense here

#

Since you're using IL2CPP, try turning down the stripping level in the project settings

tawny osprey
tender surge
#

I'm guessing I can't do that since this is a game mod

slate echo
#

no mod support on this server

#

you'll have to find help elsewhere

copper vigil
slate echo
#

ya if you ever see missing method type errors assume its mod shit

copper vigil
#

Yep that library code is gonezo

#

anyway - yeah no mod discussion on this server unfortunately