Apple Silicon Support
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on Voice.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Apple Silicon Support
paulgumr
2022-01-26 11:00:32
We are using Photon Voice 2 v2.29 across a number of platforms. Whilst we can build and run our application for Apple Silicon Macs (using Unity) we get problems that I think are PunRPC related.
We don't have any Apple Silicon to test on, which I need to resolve. However, does anyone know whether Photon is supported on Apple Silicon?
Comments
Hi @paulgumr,
Thanks for your report!
However, in my opinion, this forum post is a bit confusing.
You're posting on Photon Voice category and mentioning Photon Voice 2 version while the issue, according to you is PunRPC related. That's more of a PUN issue right? I will move this discussion to PUN category if I may.
Do you have more details about this issue? how to reproduce? error log, etc.?
How could you tell it's PunRPC related?
PUN should be supported on Apple Silicon. @Tobias can confirm.
Photon Voice support for Apple Silicon is experimental.
My apologies, I download Photon Voice and so that's what I started with. However, the voice element works, it is when we use the synchronisation with RPCs that the problems manifest themselves.
Now you have said it should work, I will get hold of a Mac Silicon device run some checks and report back.
Hey @paulgumr,
no worries!
let us know how the tests go
@JohnTube
OK after a swift dash to the Apple Store I now have a Mac Mini M1.
Initial setup of the existing working project with Unity 2021.2.9f1 (silicon) using Photon Voice v2.29 (inc PUN v2.40)
Running in Unity on the M1 Mac Mini this is the error message I get for all of the RPCs in the Unity console, xxxxx being the name of our method. PhotonView numbers are set at runtime.
RPC method 'xxxxx (Int32, String)' not found on object with PhotonView 8. Implement as non-static. Apply [PunRPC]. Components on children are not found. Return type must be void or IEnumerator (if you enable RunRpcCoroutines). RPCs are a one-way message.
These messages don't appear on the Intel Mac, nor on any of the other platforms we build for (Windows, Android and iOS)
However, firstly it's inconsistent and I can't pin down what causes it to fail. Secondly the RPC method its calling is not associated with the component with the PhotonView number. However, the RPC lists are identical.
To add to the confusion if I run the asteroids demo in the PUN directory I don't get any of the issues. That uses the same RPC calls we are using for the fire function.
I shall keep digging
@JohnTube
Further update. Just to clarify I am no Mac expert.
Turns out the issues we were seeing with the RPC methods were down to a mix up with builds and somehow we were using v2.28 (Pun 2.39) and v2.29(v2.40). Once we had all the platforms at v2.29 the RPC issues disappeared.
However, we still have issues with v2.29 on Mac Silicon, but now only the following.
[MyAudioManager.PhotonVoiceNetwork] 2022-01-31T11:48:52:[PV] OpusCodec.Encoder: POpusCodec.OpusException: invalid argument
at POpusCodec.Wrapper.HandleStatusCode (POpusCodec.Enums.OpusStatusCode statusCode) [0x00015] in /xxxxx/Assets/Photon/PhotonVoice/PhotonVoiceApi/Core/POpusCodec/OpusWrapper.cs:285
Which means we don't get any voice from the Mac Silicon client. Howver the microphone is receiving sound as we can see the recorder.LevelMeter changing.
The temporary workaround is to build for MacOS Intel. Apple now seems to include Rosetta by default and so this allows us to use the same binary on Mac Silicon. However, it only works with Unity selected as the Microphone Type, the Photon source Microphone Type is distorted.
All of this means I do not use the combined build, that Unity offers, but build for MacOS Intel on a MacOS Intel platform. Then use that binary on both.
If I build on the Mac Mini M1 with Unity silicon editor (2021.2.9f1) for Apple Silicon then I get the error noted above.
Hi @paulgumr,
Photon Voice support for Apple Silicon is still experimental.
Since this is a work in progress we are probably not going to have full support for this until Unity 2021 LTS is out.
@JohnTube
Ok, I have a workaround as explained, but mark me down as an interested party for any notifications of further updates.
hey @paulgumr,
Regarding macOS Apple Silicon (M1) support for Photon Voice: we have discussed internally and we decided to involve some select customers into beta testing this you need Unity 2021.2.x and test either w/ PhotonVoiceLibs set to "Any CPU" or set to "Apple Silicon" and give us back your feedback.
here is a patch to apply to latest Photon Voice 2 (2.29): https://drive.google.com/open?id=16hAk1DL0IcbnlYZxYUkWEsdzts5Hko5f
more info about Unity Editor Apple Silicon support:
https://forum.unity.com/threads/now-available-native-apple-silicon-editor-preview-builds.1122712/ https://isapplesiliconready.com/app/Unity
you may also need this
One possible problem is that libraries are marked as quarantined. I run xattr -d com.apple.quarantine *.bundle in Assets/Photon/PhotonVoice/PhotonVoiceLibs/OSX folder and at least editor is able to run the voice demo app now
@John Do you have similar patches for the Fusion library?
I tried setting up the Fusion 100 demo as well as checked out the Tankograd Sample, both get me the
DllNotFoundException: nanosockets assembly:<unknown assembly> type:<unknown type> member:(null)
Fusion.Sockets.NetAddress.CreateFromIpPort (System.String ip, System.UInt16 port) (at Fusion/Fusion.Sockets/NetAddress.cs:119)
Fusion.Sockets.NetAddress.Any (System.UInt16 port) (at Fusion/Fusion.Sockets/NetAddress.cs:98)
Fusion.NetworkRunner.StartGameModeCloud (Fusion.StartGameArgs args) (at Fusion/Fusion.Runtime/Runner/NetworkRunner.Matchmaking.cs:661)
UnityEngine.Debug:LogException(Exception)
Error when Fusion tries to connect.
On Linux I don't see this error. My main development machine is a macbook M1 though and I only have access to the Linux machine sometimes, so being able to use my main development machine is important. Also the main outlet for our project will be an ARKit app, where we need to build on macos anyway.
Hi @Bersaelor,
Thank you for choosing Photon!
No sorry, you need to wait until Fusion adds support for this.
You can keep an eye on this on discord.
Bersaelor 2022-02-18T16:41:58+00:00
@John Do you have similar patches for the Fusion library?
I tried setting up the Fusion 100 demo as well as checked out the Tankograd Sample, both get me the
DllNotFoundException: nanosockets assembly:<unknown assembly> type:<unknown type> member:(null) Fusion.Sockets.NetAddress.CreateFromIpPort (System.String ip, System.UInt16 port) (at Fusion/Fusion.Sockets/NetAddress.cs:119) Fusion.Sockets.NetAddress.Any (System.UInt16 port) (at Fusion/Fusion.Sockets/NetAddress.cs:98) Fusion.NetworkRunner.StartGameModeCloud (Fusion.StartGameArgs args) (at Fusion/Fusion.Runtime/Runner/NetworkRunner.Matchmaking.cs:661) UnityEngine.Debug:LogException(Exception)Error when Fusion tries to connect.
On Linux I don't see this error. My main development machine is a macbook M1 though and I only have access to the Linux machine sometimes, so being able to use my main development machine is important. Also the main outlet for our project will be an ARKit app, where we need to build on macos anyway.
So this was fixed,
to solve this, after importing the SDK go to:
Assets\Photon\Fusion\Plugins\NanoSockets\macOS\Intel\libnanosockets.dylib
Remove Check from **Editor**
& **Standalone**
and click Apply
Then go to:
Assets\Photon\Fusion\Plugins\NanoSockets\macOS\AppleSilicon\libnanosockets.dylib
Enable the platforms **Editor**
& **Standalone**
and click Apply