Skip to content

Conversation

@jfreire-unity
Copy link
Collaborator

Description

https://jira.unity3d.com/browse/ISX-1591

Changes made

Assets without any action maps and control schemes are not set as "dirty" anymore.

Notes

@Pauliusd01 since you reported this, please try it out and check if it solves the reported issue.

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • FogBugz ticket attached, example ([case %number%](https://issuetracker.unity3d.com/issues/...)).
    • FogBugz is marked as "Resolved" with next release version correctly set.
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

@ritamerkl
Copy link
Collaborator

LGTM, only one thing: what happens if you have an existing asset and delete all action maps and control schemes? should still be dirty then, right? (it's a edge case, but still worth trying I think)

@Pauliusd01
Copy link
Collaborator

Pauliusd01 commented Oct 2, 2023

LGTM, only one thing: what happens if you have an existing asset and delete all action maps and control schemes? should still be dirty then, right? (it's a edge case, but still worth trying I think)

Good catch, this indeed does not trigger the dirty state even though it should. @jfreire-unity

Copy link
Collaborator

@Pauliusd01 Pauliusd01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating status to waiting for fixes

Ideally at this stage, the file on disk should have a serializable equivalent as the serialized asset. However, because the new asset on disk is being created with a specific default json layout, the serialized JSON asset doesn't have not the same content.
There are opportunities for change in this area.
@jfreire-unity
Copy link
Collaborator Author

@Pauliusd01 thanks! you can try again

@jfreire-unity
Copy link
Collaborator Author

LGTM, only one thing: what happens if you have an existing asset and delete all action maps and control schemes? should still be dirty then, right? (it's a edge case, but still worth trying I think)

Yep, quite on point use case. Thanks! I fixed it now

@jfreire-unity jfreire-unity requested a review from ekcoh October 4, 2023 12:25
// If it is, there's nothing to save.
// At the moment, an asset only has the default asset layout content on disk when it is first created.
// So in this case we cannot go through the normal path and compare what's on disk with what has been serialized.
if (InputActionAsset.HasDefaultJsonLayout(m_AssetJson) && asset.IsEmpty())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this specific to this editor? I would recommend moving the logic to the associated utils class or making it an editor-only extension for the asset?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Remove the method and just have it inline as I don't know if it needs to be used elsewhere at the moment.
Checking if the asset is empty is not editor dependent.

/// InputActionAssets.
/// </remarks>
public const string Extension = "inputactions";
////REVIEW: actually pre-populate with some stuff?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the content after a save of an empty asset? Not sure why do not initialise it like that when its created? Then we wouldn't need these checks at all and the equality check would solve that for us

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@Pauliusd01 Pauliusd01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, did not notice anymore unusual scenarios where the asset gets dirty when it shouldn't (when undoing changes, redoing, creating new ones, cancelling already made ones and seeing if they are still dirty, etc)

@jfreire-unity jfreire-unity requested a review from ekcoh October 5, 2023 10:11
@jfreire-unity jfreire-unity merged commit fe19081 into develop Oct 6, 2023
@jfreire-unity jfreire-unity deleted the isx-1591-make-new-empty-assets-not-dirty branch October 6, 2023 13:31
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.

5 participants