Fix for apple/unityplugins#102 - obsolete method in Unity 6000.4 and newer versions throws error. - #104
Fix for apple/unityplugins#102 - obsolete method in Unity 6000.4 and newer versions throws error.#104michalDerer wants to merge 8 commits into
Conversation
|
There seem to be a few other places this is used https://github.com/search?q=repo%3Aapple%2Funityplugins%20GetInstanceID&type=code Can you update those as well? |
|
Yes, I'll check it out. |
…g errors in Unity 6000.4 or newer
…in Unity 6000.4 or newer (unity side)
… in Unity 6000.4 or newer (native side)
…in Unity 6000.4 or newer (unity side)
… in Unity 6000.4 or newer (native side)
|
Done. The old, obsolete method GetInstanceID() returns an int, while the new replacement method GetEntityId() returns an structs EntityId, from which a ulong representing the entityId can be obtained. In Apple.Accessibility, unity and native part are storing elements using int keys obtained by GetInstanceID(). The remaining changes are minor replacements. |
ryzngard
left a comment
There was a problem hiding this comment.
Thanks for contributing this! I think we can find a simplified path forward in Accessibility to make maintenance easier.
| static AccessibilityTraitsDelegate __axTraitsDelegate = NULL; | ||
| static AccessibilityTraitsDelegate2 __axTraitsDelegate2 = NULL; | ||
| APPLE_ACCESSIBILITY_EXTERN void _UnityAX_registerAccessibilityTraits(AccessibilityTraitsDelegate delegate) { __axTraitsDelegate = delegate; } | ||
| APPLE_ACCESSIBILITY_EXTERN void _UnityAX_registerAccessibilityTraits2(AccessibilityTraitsDelegate2 delegate) { __axTraitsDelegate2 = delegate; } |
There was a problem hiding this comment.
Likely a better approach here is to just convert everything to uint64_t and get rid of the int32_t. To my understanding that shouldn't change behavior and uint64_t is guaranteed to be able to hold all values int32_t can
There was a problem hiding this comment.
Yes, on native and unity side could remain only uint64_t interface.
Then in unity, code for unity versions 6000.3 or older would had to be converted to use uint64_t keys and interface.
A script in the Apple.Core plugin contains a method that becomes obsolete in Unity 6000.4 and newer versions, causing an error.
In that case, GetEntityId() must be used instead.
Fixes #102