Search Issue Tracker
Fixed in 2018.1.X
Votes
1
Found in
2017.2.0p1
Issue ID
966348
Regression
No
iPhone X has wrong Device enumeration
_DeviceModel in UnityDeviceModel() in DeviceSettings.mm is returning the wrong value for an iPhoneX, so UnityEngine.iOS.Device.generation is returning the incorrect enum for an iPhoneX. It returns iPhone8Plus.
_DeviceModel is returning iPhone10,6 for my iPhoneX, but the test in UnityDeviceGeneration() in that same file, DeviceSettings.mm assumes 10,6 is iPhone8Plus.
Change the code at line 96 of that file in an iOS build to have an NSLog at the end, to say :
extern "C" const char* UnityDeviceModel()
{
static const char* _DeviceModel = NULL;
if (_DeviceModel == NULL)
{
size_t size;
::sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char* model = (char*)::malloc(size + 1);
::sysctlbyname("hw.machine", model, &size, NULL, 0);
model[size] = 0;
_DeviceModel = AllocCString([NSString stringWithUTF8String: model]);
NSLog(@"device model: %s", _DeviceModel);
::free(model);
}
this returns iPhone10,6, which is tested in DeviceSettings.mm :
else if (!strncmp(model, "iPhone10,2", 10) || !strncmp(model, "iPhone10,6", 10))
_DeviceGeneration = deviceiPhone8Plus;
which is incorrect.
Comments (2)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Maisey
Apr 20, 2018 09:57
Is this fixed in 2017.4?
protopop
Nov 20, 2017 02:19
BTW i found this which has both 10,3 and 10,6 as iPhone X codes:
iPhone10,3 : https://everymac.com/ultimate-mac-lookup/?search_keywords=iPhone10%2C3
iPhone10,6 : https://everymac.com/ultimate-mac-lookup/?search_keywords=iPhone10%2C6