Search Unity

Bug Graph asset generates changes without reason

Discussion in 'Visual Effect Graph' started by Qriva, Mar 24, 2021.

  1. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    I am working with friend on the project and recently we did upgrade to 2020.3 LTS. From that time VFX started to generate random changes. More precisely, whenever he makes changes in VFX graph and commit them to git, when I download them Unity decides they are not saved and removes some serialized data.
    I am not 100% sure, but it most likely happens when I use given VFX during playmode.

    What I noticed, there is m_saved flag and when I get his commit it is set to 0, but later my editor changes it to 1. Here is full example of git diff:
    Code (CSharp):
    1. @@ -47,11 +47,11 @@ MonoBehaviour:
    2.    m_UIInfos: {fileID: 114340500867371532}
    3.    m_ParameterInfo: []
    4.    m_ImportDependencies: []
    5.    m_GraphVersion: 6
    6.    m_ResourceVersion: 1
    7. -  m_saved: 0
    8. +  m_saved: 1
    9.    m_SubgraphDependencies: []
    10.    m_CategoryPath:
    11. --- !u!2058629511 &8926484042661614527
    12. VisualEffectResource:
    13.    m_ObjectHideFlags: 0
    14. @@ -2169,30 +2169,5 @@ MonoBehaviour:
    15.      m_serializedType:
    16.        m_SerializableType: UnityEngine.Texture2D, UnityEngine.CoreModule, Version=0.0.0.0,
    17.          Culture=neutral, PublicKeyToken=null
    18.    m_Direction: 0
    19.    m_LinkedSlots: []
    20. ---- !u!114 &8926484042661614688
    21. -MonoBehaviour:
    22. -  m_ObjectHideFlags: 0
    23. -  m_CorrespondingSourceObject: {fileID: 0}
    24. -  m_PrefabInstance: {fileID: 0}
    25. -  m_PrefabAsset: {fileID: 0}
    26. -  m_GameObject: {fileID: 0}
    27. -  m_Enabled: 1
    28. -  m_EditorHideFlags: 0
    29. -  m_Script: {fileID: 11500000, guid: d78581a96eae8bf4398c282eb0b098bd, type: 3}
    30. -  m_Name:
    31. -  m_EditorClassIdentifier:
    32. -  m_UIIgnoredErrors: []
    33. -  m_Parent: {fileID: 0}
    34. -  m_Children: []
    35. -  m_UIPosition: {x: 0, y: 0}
    36. -  m_UICollapsed: 1
    37. -  m_UISuperCollapsed: 0
    38. -  title:
    39. -  m_Owners: []
    40. -  dataType: 0
    41. -  capacity: 128
    42. -  stripCapacity: 1
    43. -  particlePerStripCount: 128
    44. -  m_Space: 0

    I could not find any other complaints about that, is it only my problem?
    In any case how should I handle these changes, commit them every time? This is very annoying.
     
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi @Qriva ,

    This is a known issue; the fix has already landed in 2021.2.0a8.1261, and there's a backport on the way for 2020.3 which should hopefully land soon.

    Yup, quite an annoying issue, hopefully if you are able to upgrade to the latest 2020.3 LTS once the fix lands you won't have to deal with it again. Apologies for any grief this has caused you and your friend!
     
    Qriva likes this.
  3. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    Thank you very much for clarification and fast response! I am glad it will be fixed soon, is there link to the issue or something like this, so I can track the progress and see when it's finished?
     
  4. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Afraid not, I tried to get one, but it was logged internally without a public-facing reference. Made a note on the case to get notified of changes and have linked the forum post here, so if that works for you I'll drop you a note here once it lands with the version it lands in.
     
    Qriva likes this.
  5. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi @Qriva ,

    The fix landed in 2020.3.4, which as of today is publicly available. Thanks for your patience, hope this resolves your issue! :)
     
    Qriva likes this.
  6. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    We tested this today and it works correctly now, thank you!
     
    VladVNeykov likes this.
  7. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    Hello again, I noticed that in some circumstances this problem still persists. For example today I upgraded version from 2020.3.4 to 2020.3.14 and changes appeared in files.
    I don't know why this happen, at least not yet, but are there any new reports about similar things? or maybe you are aware or it was fixed already before 2020.3.14?
     
  8. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Were the changes just once (from one to another version), or the original issue of constantly persisting changes even after something has been committed to git?
     
  9. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    2020.3.4 fixed the issue at first glance, but 2-3 weeks after that someone duplicated graph made before that update and these changes appeared again, but because it was old graph I thought that this could happen - maybe graph was corrupted from previous versions, so I ignored it, but yesterday changes were generated in graphs I made to report this bug, and it was month ago.

    In short the issue was mostly fixed, but something, somewhere still causes changes to appear sometimes.
    When I found the way to reproduce this, I will let you know.
     
  10. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    @VladVNeykov I think I possibly found some hint, but it is not exactly the same as I described in first post.
    My current version 2020.3.14 and Visual effect graph 10.5.1:

    Today I made duplicate of some graph and edited both of them, then saved them and commited changes to repo. I restared Unity and at this point everything was as it should be. Next, I clicked edit on one of them and save star (*) appeared next to the graph name, but graph wasn't modified by me yet.
    I closed the tab without pressing "save". Then I edited another one, but this time I pressed "save" before closing. At this point git said that there is change in both of them, one was flag set to 1 and other one to 0.
    Code (CSharp):
    1. // First
    2. -  m_saved: 1
    3. +  m_saved: 0
    4. // Second
    5. -  m_saved: 0
    6. +  m_saved: 1
    Additionaly I tried to open graphs again and click save or do one change and revert it with Ctrl+Z, I managed to change flag in one of them (git said no changes in file) and again with some changes/closing it appeared again.

    Also I am not sure after what action these changes were produced, but my conclusion is: there might be something wrong with closing graph without save or undo-ing change and closing.

    // EDIT - I managed to create reproduction steps to behaviour described above, at least with my graph:
    1. There is graph commited to repo with no current changes
    2. Double click graph asset to open graph window
    3. Change number value in some node (I did constant spawn: Rate) and click somewhere outside to unfocus node.
    4. Press Ctrl+Z twice - one to change focus and second to revert change
    5. Close window without pressing save
    6. Open graph again (step 2)
    7. Press "Save" and close window (tab)
    8. Git should detect change - m_saved should change state.
    9. Opening, saving and closing window again should change state again.
     
    Last edited: Jul 23, 2021
  11. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi @Qriva, I can repro with your steps in 2020.3.14f1 / 10.6. I tried this also in 2021.2.0b4 and it looks fixed there. Thanks for the repro steps, will bring this up with the team and see if the fix is something feasible for a backport. (It might take a bit of time with summer vacations.)

    Thanks again for the extra info!
     
    Qriva likes this.
  12. peaj_metric

    peaj_metric

    Joined:
    Sep 15, 2014
    Posts:
    146
    I have an issue that seems to be connected to this: https://fogbugz.unity3d.com/default.asp?1355820_pjkdkmcc0uephn4c
    We recently upgraded to 2020.3.14 as I hoped it might fix the problem with the "m_saved" flag.
    But there are still seemingly random changes to the vfx files and when opening any VFX Graph they are always displayed as modified (*).
    The worst thing is that the order of calculations in the graph changes depending on its "state".
    Opening a scene, opening a graph for edit, saving a graph, or even slecting a node while saving a graph may all lead to different outcomes for the VFX effect.
    In my case the effect ends up in a different position as the order of position and rotation transformations changes.
    In some cases saving one graph even broke another one (they share subgraphs).
     
  13. peaj_metric

    peaj_metric

    Joined:
    Sep 15, 2014
    Posts:
    146
    I just figured that without subgraphs the asterisk* vanishes after saving the graph but it reappears after closing and reopening the project. At least the graph without subgraphs did not scramble the transformations (yet)
     
  14. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi @Qriva ,

    @JulienF_Unity pointed out that m_saved is removed in 10.6; if you upgrade to the next public version, recompile and commit your VFXs, the field should be gone and the issue you mentioned should no longer reproduce.

    @peaj_metric thanks for logging this issue, we will take a look!
     
  15. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    Next public version of VFX Graph or something else? I assume it means 10.6.1 or 10.7.
     
  16. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Yup, in VFX package 10.6 onwards you shouldn't get the issue anymore. You'll have to recompile/save your VFXs and commit them with the now removed m_saved. Then you should be good after this, I tried with your repro steps.
     
    Qriva likes this.
  17. Slaktarkuno

    Slaktarkuno

    Joined:
    Dec 3, 2021
    Posts:
    10
    Can report that the issue still persists in 2022.2.14f. Recompilations trigger whenever we do pretty much anything.