Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Does the obsolete UnityEngine.WWW class work on the new Apple Silicon M1 ?

Discussion in 'macOS' started by manutoo, Jan 29, 2023.

  1. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    522
    Hello,

    my game can load sound files using the WWW class without issue on Windows & legacy Mac Intel CPUs.

    I just upgraded from Unity 2019.4 to 2021.3 and now it doesn't work with my 1st time building directly for the Apple Silicon target. (before the Apple M1 users were using Rosetta and it was working fine)

    I have 2 users with M1 CPUs who have reported their Modded sounds not playing in my game. One user reported the sounds were working correctly if the game wasn't Modded.

    I don't have an M1 CPU so I cannot test by myself.

    I have no idea why it doesn't work, and my only guess is that Unity didn't implement the WWW class on the Silicon target, but I think it should have shown a warning or something, but maybe I just missed them.

    Anyone would have any idea about this ?

    Thanks in advance for any answer. :)


    EDIT:
    it turns out it fails also on my old Mac as well, so it's not related to M1/Silicon. (I had only reports from M1 users, but I guess it just means there are not many non-M1 users on Mac anymore)

    As it was working without any issue in the previous version of my game, this means something changed from Unity 2019 to Unity 2021 only on the Mac and not on Windows. :confused:

    I'm going to investigate... :cool:
     
    Last edited: Jan 30, 2023
  2. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    522
    Ok, I found the issue : for loading local files, WWW on MacOS with Unity 2019 was accepting "file:///" although it's a Windows-only formatting.

    In Unity 2021, it should be for MacOS : "file://" .

    The correct way to get it automatically on both OS is :
    Code (CSharp):
    1. System.Uri Url = new System.Uri(AbsolutePathToMyFile);
    2. WWW WwwLoader = new WWW(Url.AbsoluteUri);
     
  3. ronchito

    ronchito

    Joined:
    Dec 4, 2013
    Posts:
    12
    Hi @manutoo, it seems like I have exactly the same issue.
    I tried adding the prefix "file://" or "file:///", but it still doesn't work (although it used to work when I used unity 2019. Now I use 2021).

    Www is obsolete as you mentioned in the title, and the recommended way is to use UnityWebRequest:
    using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(fullPath, AudioType.WAV)).

    Although it works well on Windows and Android, it doesn't work on Mac and iOS devices.

    I opened a thread before I saw yours where I explain my issue in more details:
    https://forum.unity.com/threads/can...datapath-in-unity-editor-for-mac-ios.1401844/

    Do you have any hints regarding that topic?
     
    Last edited: Feb 18, 2023