Skip to content

Checks and fixes for pasting copied reference fields#103

Open
Logyrac wants to merge 2 commits into
mackysoft:mainfrom
Logyrac:f_copy_paste_fixes
Open

Checks and fixes for pasting copied reference fields#103
Logyrac wants to merge 2 commits into
mackysoft:mainfrom
Logyrac:f_copy_paste_fixes

Conversation

@Logyrac

@Logyrac Logyrac commented Jul 13, 2026

Copy link
Copy Markdown

Description

When copying and pasting values from a property's context menu, there were currently no checks in place to avoid certain issues:

  • Attempting to paste to a property who's current value is null causes an error due to JsonUtility.FromJsonOverwrite
  • Pasting a value from one type into a field of a different type, which may or may not have the appropriate fields

Added logic to check for potential conflicts and handle them.

Changes made

  • Store the copied field type in SessionState for use in type safety comparisons
  • Test for potential conflicts and return result as enum for handling
  • Implement menu items for different results:
    • When no issues are detected or copied value is empty continue as before, with no change
    • When copied value is different type than current value, but still valid for the property, then pasting will create a new instance via Activator and then merge the JSON in. The Paste menu item shows a warning that the type will be overwritten.
    • When current value is null, create a new instance using Activator before using JSON overwrite to avoid error.
    • When copied value type is not valid for the field (uses TypeCandiateService [which is mis-spelled as a note, should be Candidate]) then disable the menu item with message explaining incompatible type.
    • When copied value refers to an invalid of non-existent type (type may be deleted between copy and paste) add disabled item with text stating invalid type
  • Exposed function for evaluating qualification from TypeCandiateService, which evaluates the intrinsicTypePolicy and typeCompatibilityPolicy, for use in testing field combability in pasting, so that the TypeCandiateService is a single point of truth on this test.

@Logyrac

Logyrac commented Jul 14, 2026

Copy link
Copy Markdown
Author

Added support for pasting null values to the checks. When null is copied paste menu item will display warning that it will be set to null. If pasting null should be disallowed this is an easy change to revert.

On a separate note, it seems that most PRs recently are failing checks, the runner says the UNITY_LICENSE or UNITY_SERIAL secrets are unavailable. This is a safety restriction with GitHub and actions running on pull request, they can't access the secrets of either the source or target repository to prevent actions from potentially leaking that data, but this does throw a wrench in game-ci's builder and test runner. PRs seemed to be working before so not sure what changed, as it stands right now the tests can't be ran reliably.

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