Skip to content

Set custom interop type names via attribute instead of static property - #89

Closed
PeterCurry wants to merge 2 commits into
apple:mainfrom
dinopoloclub:interop-type-name-attribute
Closed

PeterCurry wants to merge 2 commits into
apple:mainfrom
dinopoloclub:interop-type-name-attribute

Conversation

@PeterCurry

Copy link
Copy Markdown

Goal & Changes

NSObject.GetInteropTypeName attempts to derive the Objective-C class name that a C# type is wrapping by directly converting the name, which does not work for nested types such as GKLeaderboard.Entry. This could be overridden by means of a static property on the class named InteropTypeName, but because this was checked via reflection, it could easily be code-stripped and proved unreliable in builds.

To make this less reliant on reflection and more reliable, I've changed the technique to use a new attribute (InteropTypeNameAttribute) instead of a static property. NSObject.GetInteropTypeName now checks for the attribute instead of a static property. The one place this was used in the library (GKLeaderboard.Entry) has been updated.

Change NSObject.GetInteropTypeName to ceck for InteropTypeNameAttribute instead of looking for static InteropTypeName proprety.
@PeterCurry PeterCurry closed this Apr 10, 2026
@PeterCurry
PeterCurry deleted the interop-type-name-attribute branch April 14, 2026 04:04
pull Bot pushed a commit to 16CentAstrology/unityplugins that referenced this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant