BranchMetrics / unity-branch-deep-linking-attribution

The Branch Unity SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/apps/unity/
MIT License
118 stars 24 forks source link

SDK-1499: Cannot input Line App Links for BranchPrefab when field leaves focus #202

Closed rob-gioia-branch closed 2 years ago

rob-gioia-branch commented 2 years ago

Link to Ticket: https://branch.atlassian.net/browse/SDK-1499

Description of Issue: When adding in the domains as array elements of the app links array in the Branch prefab, the values would disappear from the input field once it lost focus

Fix: The value for the array elements was being assigned inside of Unity's OnInspectorGUI() lifecycle method. This caused the empty array elements from the BranchDataObject to keep populating the Branch prefab values every time the inspector was redrawn (after a change, i.e. an input field losing focus)

Screen Shot 2022-07-29 at 10 06 13 AM

To fix this issue, the fetching of these values was moved into OnEnable so that the initialization with FindPropery() occurs once and then the fields will be updated by the existing code inside of OnInspectorGUI() (i.e. The EditorGUILayout.PropertyField calls)

Screen Shot 2022-07-29 at 10 06 49 AM