I’m using some optional libraries in my app that do not have support for M1 macs and I’d like to be able to skip loading them to since they’d otherwise make my app crash at some point.
Is there a way to check in my code whether or not I’m running on a M1 mac? Just going by the processor name using SystemInfo.processorType works in some cases, but is unreliable (could be “Apple M1”, “VirtualApple”, probably some more).
It’s a “normal” macOS build, signed and uploaded to Steam, which I’d assume means it’s running via Rosetta (don’t have a M1 Mac myself, will have to ask my users). Actually I wasn’t even aware Unity could do native M1 builds already.
Thanks. Still having some trouble getting this to work properly since I can’t figure out how to access errno after the P/Invoke. If you happen to have any code for that or can point me in the right direction, that’d be awesome.
Will keep working on this and post here if I figure something out.
Wrap sysctlbyname and errno interactions into a small dylib and P/Invoke into that.
Just disregard errno. It doesn’t matter what it is: if sysctlbyname fails, just assume you’re not running on Rosetta/Apple silicon hardware. The fact that there’s an error doesn’t change the outcome of whether you want to load the plugins or not.