Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[Solved] Issue with .asset files updating through Collab

Discussion in 'Unity Collaborate' started by Maccu87, Feb 22, 2017.

  1. Maccu87

    Maccu87

    Joined:
    Jan 15, 2016
    Posts:
    3
    I have noticed this has happened a couple of times now. When publishing changes from one system and pulling .assets created from scriptableobjects down onto another, the changes are not correctly updated. Sometimes it seems to create the required amount of items in the list but does not populate the values correctly?

    Anyone else experienced this?
     
  2. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,264
    Hi @Maccu87! Could you go into a little more detail about the issue you're seeing? With regards to the items in the list, are those items in a custom .assets file or in the Collab Toolbar? Can you submit a bug from this project with steps on how to to repro this behavior?
     
  3. Maccu87

    Maccu87

    Joined:
    Jan 15, 2016
    Posts:
    3
    So I have created a ScriptableObject for some items like so:
    Code (CSharp):
    1. public List<ItemData> Items;
    and using [CreateAssetMenu] to be able to create an asset out of the ScriptableObject. After populating the asset with data, such as filling out the 'ItemData' with name, type etc, if I commit the changes, and pull them down on another machine, the changes to the .asset file do not seem to have been pushed/pulled. A friend of mine is experiencing a similar issue to this. I have found it to actually cause the entire asset to be wiped out of data once too. I hope this makes more sense?
     
  4. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,264
    Gotcha. Thanks for the quick reply. This bug will be fixed in the latest 5.6 beta.

    In the meantime, could you try refreshing your ScriptableObject by going into the Project Window, right-clicking on the script then clicking "Refresh"? If it's the same bug that was just fixed then doing that should resolve your issue. If not then could you report a bug with your project?
     
  5. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    399
    We're having a problem similar to this. This is what we are seeing:

    1. Two team members, both editing the same .asset (scriptableobject) file.
    2. My teammate pushes changes.
    3. I pull the commit but receive no merge conflict warning. It appears the file is partially overwritten/merged. Some fields are changed but not all, and no idea how it's picking which to merge. The icon in the project window still indicates that I need to push the asset file / I have made changes to it.
    4. Now I'm afraid to push my commit, since I have no idea if my teammate's version of the file will be overwritten/changed.

    We are using Unity 5.5 - is there a reason why fixes can't be propagated to 5.5? We really love Collaborate, it has made version control and collaboration so much easier for us, so it'd be great to get new fixes/features for 5.5. Any ideas what we can do?

    Thanks!

    EDIT:

    Just saw that I'm getting this warning message in the console:

    "Someone else also changed '**NameOfAsset**'. The changes were merged and a backup of your original file was copied to '**FileLocation**'"

    I compared the two versions and it's clear that collaborate is "smartly" merging the two files.
    But what we really want is for Collaborate to warn us before we pull the file, like it does with other file, instead of just deciding by itself to back up and merge the two versions. That way, at least we know and can choose what we want to happen. Is there anyway to change the default behaviour to force a merge conflict message?
     
    Last edited: Apr 26, 2017
  6. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,264
    Hi @flashframe! Thank you for letting us know about these issues. Asset files from ScriptableObjects currently do not auto-merge as intended. A bug has been filed and we hope to address this issue in the future.

    In the meantime, I would recommend that only one of you work on a .asset file generated from a ScriptableObject at a time. If you push what changes you have in your .asset file now then your teammate will get the same changes if they don't have any local changes on that file. If your teammate does, though, then there's a chance that their changes will get overwritten or duplicated. I'm very sorry about this and hope that you two don't lose too much work over this.

    As far as backporting fixes goes, I'm very happy to hear that you both love Collaborate so much and we want to keep making it better for users like you, both by making these kinds of fixes and by adding more cool, useful features. Unfortunately, we don't have enough time in the day to do all that AND backport non-critical bug fixes to earlier versions :(. I understand that upgrading to new versions isn't always an option for some teams and know all too well how frustrating it is when a bug fix you really want doesn't make it into a patch for an earlier version. But we really appreciate your patience with us and hope that you'll continue to use Collaborate as well as let us know when something doesn't work right.
     
  7. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    399
    Hi @ryanc-unity

    Thanks for the reply :)

    We've decided the best approach is to split up our asset file into smaller "per scene" assets - which fits in with the workflow of not editing the same scene concurrently, while still allowing us both to edit parts of the data set.

    I understand and sympathise regarding lack of time! We are just at a point in our game that updating Unity versions is a real headache. Everything has a cost :-(

    Collaborate is great though, and other than this issue it has worked out really well for us, so thank you for the work you and your team are doing.
     
    ryanc-unity likes this.
  8. zeb33

    zeb33

    Joined:
    Nov 17, 2014
    Posts:
    91
    Hi. we seem to be having same issue with unity 2017.2.f03. Is there still an issue with collab and ScriptableObject?
     
  9. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,264
    Hi @zeb33! I'm sorry to hear that you're running into this issue. Can you go into more detail on when you're seeing this issue? Are you and a teammate editing a ScriptableObject at the same time and trying to merge your changes?
     
  10. Arkas000

    Arkas000

    Joined:
    Jun 9, 2013
    Posts:
    1
    Hello @ryanc-unity I've the same issue with 2017.2. I'm the only person of the team that edits the ScriptableObjects. Pushing the changes doesn't seem to affect the values of the scriptableObjects. If I try to change an int value for example and then push it, then the updated value doesn't arrive to my team.
     
  11. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,264
    Hi @Arkas000! Do you happen to have a small sample project that you would be willing to share that reproduces this bug? It would really help us out in coming up with a fix for it. Not everyone on the team is super familiar with ScriptableObjects so the more real life examples we can look through to test a fix against, the better.

    You could either submit your sample project using Unity's Bug Reporter and forward me the bug number or you could DM me your sample project's UPID and I can make a copy of it to test with.
     
  12. oakshiro

    oakshiro

    Joined:
    Dec 9, 2008
    Posts:
    19
    Still happens on 2017.2.0f3. We have to be super carefully and delete + revert the scriptableobjects anytime one of our teammates modify them.
     
  13. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,264
    @oakshiro that's terrible! Would you mind submitting a sample project with repro steps via the Bug Reporter? It would help us a great deal in finding a fix for this issue.
     
  14. oakshiro

    oakshiro

    Joined:
    Dec 9, 2008
    Posts:
    19
    Ok, I'll submit it as soon as I can.
     
  15. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,264
    Thank you! Be sure to post here or send me a DM with the bug number once it's been emailed to you so that I can quickly look it up on my end.
     
  16. Nayrutes

    Nayrutes

    Joined:
    Dec 7, 2017
    Posts:
    1
    I thought I had the same bug but I didn't save my asset (ScriptableObject) properly.
    Calling EditorUtility.SetDirty(myScriptableObject) and AssetDatabase.SaveAssets() after editing values did the trick for me.
     
  17. DanVioletSagmiller

    DanVioletSagmiller

    Joined:
    Aug 26, 2010
    Posts:
    126
    I'm also having this issue (2017.3.0f3). However, I do not have a custom editor. When I have a custom editor, I have the power to say "SetDirty" and that works. but this is the default behaviour of the inspector. :( I'm submitting my project...
     
  18. PedroGV

    PedroGV

    Joined:
    Nov 1, 2010
    Posts:
    410
    The problem that I'm having is that the SOs is correctly persisted in Collaborate from a PC with Windows, but as soon as I download it into a MacOSX, some of the SOs do not retrieve the values from Collaborate so they are created with default values. And "revert" does not work because as soon as you press it, even though view changes do show the correct values on the remote file, those SOs are recreated on the MacOSX, again, with default values.

    Working with Unity 2017.1.4f1 in both machines.
     
  19. AlfieBooth

    AlfieBooth

    Joined:
    Dec 2, 2013
    Posts:
    12
    I'm having the same issue in 2018.2.15f1.
    I'm using collab between a windows and a mac machine. Collaborate registers the adding and removing of .asset SO's, and any name changes made. However any changes to the properties (in my case, one texture and a bunch of color values) are not registered, forcing me to update them manually on both machines. This is pretty annoying at the min, but eventually I will have 100+ of these .assets.

    Any help would be greatly appreciated.

    Alfie.
     
  20. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,264
    Hi @AlfieBooth! Do you happen to have a small sample project with just your .asset SO's that you'd be willing to share with us that we could use for testing? You can submit it to us either through the Unity Bug Reporter or when submitting a Support Ticket with us. Thank you in advance!
     
  21. AlfieBooth

    AlfieBooth

    Joined:
    Dec 2, 2013
    Posts:
    12
    Hi Ryan,
    Apologies for the delay. Yes of course. I'll get right on it. Thanks for your time.
    Alfie
     
    ryanc-unity likes this.
  22. flipwon

    flipwon

    Joined:
    Dec 29, 2016
    Posts:
    93
    Wow, crazy to see that this has been an issue for so long. Same here, scriptable objects aren't registering all their changes between builds :(
     
  23. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    233
    This is probably not the issue but just in case... You guys did confirm that your data serializes properly right? Certain types and custom types need extra work to serialize to an asset file. Datetime and guid are examples.
     
  24. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    419
    Its 2019, and it seems like this issue is returning with ScriptableObject.
    Has happened multiple times in recent few days..
     
  25. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,264
    Hi @Gekigengar, I'm sorry you're running into this issue so often. Could you go into more detail to help us reproduce this issue? Which version of Unity 2019 were you using, what changed fields in your ScriptableObject don't seem to be syncing properly, how often do changes with your ScriptableObject seem to go missing? When you download the entire project on a new machine, do you see all of the changes there?
     
  26. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    419
    Using 2019.1.11f1, this has happened on both machine I am using (I switch back and forth between machines with Collab). I have already submitted a bug report a few days ago. Unfortunately, it is not always reproduce-able.

    The most recent occurrence is when I've added "Intelligence" struct to my scriptable object, and added some value to it. Though, I am not sure if it has anything to do with it. By the time I moved to the other machine, every system that requires the memory stats is broken. I later found that the issue is simply Unity not updating the scriptable objects assets, even if everything else is updated even when Collab says everything is up to date.

    Other scriptable objects were also not synchronized, as I've made changes to a few values for my LOItemData .asset files.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. namespace LightsOut
    6. {
    7.     [CreateAssetMenu(fileName = "New Base Character Stats Configuration", menuName = "LightsOut/Character/Base Character Stats Configuration", order = 1)]
    8.     public class BaseCharacterStatsConfiguration : ScriptableObject
    9.     {
    10.         public LOStats characterStats;
    11.     }
    12. }
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using System;
    5.  
    6. namespace LightsOut
    7. {
    8.     [Serializable]
    9.     public class LOStats
    10.     {
    11.         public CharacterInformation Information;
    12.         public HealthStats Health;
    13.         public IntelligenceStats Intelligence;
    14.         public VisibilityStats Visibility;
    15.         public MovementStats Movement;
    16.         public InventoryStats Inventory;
    17.     }
    18.  
    19.     [Serializable]
    20.     public struct CharacterInformation
    21.     {
    22.         public string characterFirstName;
    23.         public string characterLastName;
    24.         public bool tryHookUI;
    25.     }
    26.  
    27.     [Serializable]
    28.     public struct HealthStats
    29.     {
    30.         public float baseMaxHP;
    31.         public float multiplierMaxHP;
    32.     }
    33.  
    34.     [Serializable]
    35.     public struct IntelligenceStats
    36.     {
    37.         public int baseMemoryLimit;
    38.     }
    39.  
    40.     [Serializable]
    41.     public struct VisibilityStats
    42.     {
    43.         public float baseVisibilityPriority;
    44.         public float baseVisibilityRate;
    45.         public float multiplierVisibilityRate;
    46.     }
    47.  
    48.     [Serializable]
    49.     public struct MovementStats
    50.     {
    51.         public float baseMS;
    52.         public float multiplierMS;
    53.     }
    54.  
    55.     [Serializable]
    56.     public struct InventoryStats
    57.     {
    58.         public int primarySlotCount;
    59.         public int secondarySlotCount;
    60.     }
    61. }
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. namespace LightsOut
    6. {
    7.     [CreateAssetMenu(fileName = "New Item Data", menuName = "LightsOut/Item Data", order = 1)]
    8.     public class LOItemData : ScriptableObject
    9.     {
    10.         #pragma warning disable 0649
    11.         [Header("Generic Stats")]
    12.         public string ItemName;
    13.         [SerializeField] private string _itemDescription;
    14.         [SerializeField] private ItemHandPosition _itemCarryType;
    15.         [SerializeField] private float _itemMaxDurability;
    16.  
    17.         [Header("Item Render")]
    18.         [SerializeField] private GameObject _modelPrefab;
    19.         [SerializeField] private Sprite _itemBTN;
    20.         [SerializeField] private Sprite _itemDISBTN;
    21.         #pragma warning restore 0649
    22.  
    23.         public string ItemDescription { get => _itemDescription; }
    24.  
    25.         public ItemHandPosition ItemCarryType { get => _itemCarryType; }
    26.  
    27.         public float ItemMaxDurability { get => _itemMaxDurability; }
    28.  
    29.         public GameObject ModelPrefab { get => _modelPrefab; }
    30.  
    31.         public Sprite ItemBTN { get => _itemBTN; }
    32.         public Sprite ItemDISBTN { get => _itemDISBTN; }
    33.  
    34.         // Default values of fields here.
    35.         public virtual void Reset()
    36.         {
    37.             ItemName = "New Item Data";
    38.         }
    39.     }
    40. }
     
  27. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    1,264
    Thank you for sharing more info with me! I tracked down the bug you submitted around this issue (1177664) and will dig a little deeper into it to try to see if I can reproduce it on my end. By the "memory stats" you mentioned that would break, are you referring to the IntelligenceStats struct or to a different struct that was included in a different file? Roughly how many times out of 10 would you say that the sync issues happen when making changes around the ScriptableObjects?
     
  28. WLewis47

    WLewis47

    Joined:
    Jul 6, 2018
    Posts:
    4
    I'm having trouble with this, too. Very frustrating.

    For me, I'm having the bug with Color and Sprites.
    Code (CSharp):
    1. [SerializeField] Color posOpinionColor;
    2. [SerializeField] Color neutralOpinionColor;
    3. [SerializeField] Color negOpinionColor;
    4. [SerializeField] Sprite kingTitle;
    5. [SerializeField] Sprite dukeTitle;
    6. [SerializeField] Sprite earlTitle;
    The *.asset file actually does maintain its updates between collaborations (when I try to edit this to look proper in this post, it tells me it looks like I'm posting spam):
    posOpinionColor: {r: 0.18039216, g: 0.30980393, b: 0.18431373, a: 1}
    neutralOpinionColor: {r: 0.44705883, g: 0.40784314, b: 0.35686275, a: 1}
    negOpinionColor: {r: 0.54509807, g: 0.078431375, b: 0, a: 1}
    kingTitle: {fileID: 21300000, guid: 6fac473811e6eb942935790e15a155d4, type: 3}
    dukeTitle: {fileID: 21300000, guid: dc9311084bace4347b29329c7f5f902c, type: 3}
    earlTitle: {fileID: 21300000, guid: 574dbfda1d1374844b0eeb80d9dd2f1e, type: 3}


    But the ScriptableObject is not reflecting the data in the *.asset file:
    upload_2019-9-5_20-54-43.png

    I've tried refreshing and reimporting the *.asset, and the *.cs, but no dice.
     
  29. WLewis47

    WLewis47

    Joined:
    Jul 6, 2018
    Posts:
    4
    FWIW, I just found a fix!

    The *.asset file is adding an extra line to the very end of the file following collaboration. If I delete that line, it works. This is, of course, not ideal, and the problem will compound as the project goes, so it would be nice to get a real fix in.

    Not working:
    upload_2019-9-5_21-0-9.png

    Working:
    upload_2019-9-5_21-0-22.png
     

    Attached Files:

  30. ivanngoc

    ivanngoc

    Joined:
    Nov 9, 2018
    Posts:
    5
    Hi , evryone. Same problem here. Each time I modify Scriptable Object asset programmatic via editor script collab doesn't notice any difference. Scriptable object have OnValidate logic. And only when i change any field in editor window collab see the changes
    Unity 2019.2.6f1
     
  31. ivanngoc

    ivanngoc

    Joined:
    Nov 9, 2018
    Posts:
    5
    Solved my problem by using
    EditorUtility.SetDirty(obj);
    After that click File=>Save project.
    Only after that scriptable object .asset file has changed
     
    ryanc-unity likes this.