Search Unity

Maintainer

Discussion in 'Assets and Asset Store' started by codestage, Mar 10, 2015.

  1. NikoBay

    NikoBay

    Joined:
    Aug 15, 2018
    Posts:
    39
    Hi,
    It seems Issues Finder works. I watched an tutorial and followed it. Refer a prefab to a scriptableObject. Right click that prefab and do the Reference Search. Result returns blank. Tried other assets and never returns anything.
    - Scriptable Object referenced prefab is a public GameObject.

    "does Project Browser's context menu item "Select dependencies" called for a referencing Scriptable Object selects referenced prefab?" <- I don't understand this.

    You can check the attached screenshots.
    [Unity 2019.4.3f1, Maintainer just imported now]

    A bit about my goal, it seems an unneeded prefab is loaded into memory and I don't know which asset refers that prefab to cause such thing and I hope Maintainer can help me with this.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      69.2 KB
      Views:
      340
    • 2.png
      2.png
      File size:
      326.7 KB
      Views:
      330
    • 3.png
      3.png
      File size:
      163.9 KB
      Views:
      331
  2. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Thank you for providing all the additional details!

    Could you please right-click on MainCharacter at the Project view and call "Select dependencies" from the context menu?
    I wonder if "Bird" prefab will be selected.

    I would like to help but couldn't reproduce this problem yet. I created ScriptableObject and referenced prefab from there, then I searched for prefab references in Maintainer and it works fine.

    upload_2020-7-13_14-49-3.png

    upload_2020-7-13_14-49-32.png

    Perhaps, it's possible to get the .unitypackage with reproducible problem so I could inspect it on my side?
     
  3. NikoBay

    NikoBay

    Joined:
    Aug 15, 2018
    Posts:
    39
    I did the search again. Saw the console: [Maintainer] References Finder results: 4 items found in 8.810 seconds. But browser still shows nothing. This gives me hope at least.
    Do you have any clues?
    If not, I'll try to send you an package when I have more time :(
     
    codestage likes this.
  4. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    @NikoBay this is really strange indeed!

    Could you please check if you have any search query entered in the search bar above results list, few white spaces for example? Try pressing "x" icon there.
     
    NikoBay likes this.
  5. NikoBay

    NikoBay

    Joined:
    Aug 15, 2018
    Posts:
    39
    YOU ARE CORRECT. That "x" button saves me. Made me laugh in pain over this trivial thing wasted a lot of my time. Thanks for being patient with me over this. The tool is awesome!
    (side note: that search field is saved even after fresh reset of Unity)
     
    codestage likes this.
  6. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    haha glad it was that easy this time =D

    I'll consider resetting search term on Unity restart to avoid such confusion in future ^^
     
    NikoBay likes this.
  7. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    I guess the answer is yes, but didn't get to see it the specific case in the videos.
    If we have a Script component , and this script component is fine, but this script it has missing references to other scripts... the asset also find it as a missing reference, correct?
    Thanks
     
  8. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @pistoleta,

    Yes, Issues Finder should detect such missing references.
     
  9. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    Hello there, I'm testing the issues Finder and seems is not detecting all the missing references. I have a MonoBehaviour script attached to a gameObject in scene and its missing several things:
    TextMesh , gameobject, button, and rectTransform references.
    Its ignoring all of them, funny thing is it does detect one of the missing prefabs from that same script, when I fix it, and run again, nothing found.

    By the way this is just an example, there are much more missing references among other components like missing SO's and references to other scripts and it's not detecting any.

    PS: i removed the path filters I was using and still the same, only filter im using is the one to avoid missing sprite on Images.
     
  10. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @pistoleta

    Thank you for reporting this problem!
    Could you please show a screenshot of the inspector with those missing references Maintainer does not finds?
    Also could you please let me know what's your Unity and Maintainer versions?

    I'd like to reproduce this problem on my end so I'd be glad to know any additional information.

    Thanks!
     
  11. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    Sure, My unity is 2019.4.9f1, Mantainer v 1.7.0.





    These are from Dialog manager too:


     
  12. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    While I was looking for them I've realized something. On the DialogManager of these missing references is being actually used by the script, the only one that was being used was the one the Mantainer detected. I'm guessing that's the reason?

    And the prefab I sent you, those are scene references and can't be assigned in EditMode, I have to do it in runtime because how prefabs work, I guess thats the reason the Mantainer it's ignoring them too?
     
  13. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Thank you for the screenshots @pistoleta now I see why Maintainer does not detects them. That's because they are not missing references, just not assigned ones.

    It does not highlights not assigned fields since it's a common practice to have something not assigned here and there in most projects and in even most of standard components, otherwise it would be too annoying and might confuse users.

    Typical missing reference Issues Finder finds looks like this:
    upload_2020-9-7_20-53-34.png

    So it's actually missing meaning it was assigned and referenced item was removed after that which usually can lead to the errors and bugs, that's why it gets highlighted.
     
  14. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    I get it, but wouldn't still be useful to have an option to detect those too? it would help a lot the labour to maintain a clean code.
    Thanks a lot.
     
  15. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    It's possible to make such option but it will really mess a report since all empty fields you don't see in the inspector will get there too, like non-assigned fields in the ParticleSystems components and other inspectors which do show or hide different fields depending on the inspector values.

    Would you be interested in trying a dev version with such option if I'd make one?
     
  16. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    I see the problem.
    Maybe playing with checkboxes specifying if the variable is public, if its shownInInspector, if is visible(I dont know if this one is possible to check) it would be useful. Also of course with the filters usage.
    I dont know if this is a lot of work for you but if its not too much and you see it's possible I would be pleased to try it.
    Thanks
     
  17. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    I'm afraid it's a tough task since visibility usually is controlled via custom Editors and I don't know any APIs in Unity which would allow checking if serialized field is actually visible in the inspector or not..

    Anyways I can try making this option with naive implementation which would look for all not filled serialized reference type fields and let you take a look how it works.

    Added this to the internal todos with moderate priority.
     
  18. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    @codestage , I apologize for insisting but I still have my doubts on this:

    I found it after running the code and getting a nullRef exception, I removed the audioSource that was attached here.
    And I forgot to modify the code, when I say I removed I mean I removed the component. Should have not the buyBuildingFx reference be marked as Missing?should not the Issue Finder show it?
    thanks again.
     
  19. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    It's on the Unity side - it marks references as missing ones when something referenced gets unexpectedly removed. I'm not sure why in that particular case it wasn't marked by Unity as missing.

    Perhaps, you are using some third-party assets for the inspector which could affect this default behavior?..
     
  20. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    I've been using Sirenix Odin for almost 2 years, you think that might interfere? in normal circumstances, when removing the audio source... it should show 'Missing' instead of 'None' ?
     
  21. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
  22. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    yes, feel free to try it in a new project:
    upload_2020-9-8_15-23-14.png

    Thanks, looks interesting!
     
  23. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    Damn, it becomes always None, I tried with AudioListener, with audioSource and with a game object I created on scene and a prefab... I'll talk with the odin guys
     
    codestage likes this.
  24. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    May I ask how the asset determines if the asset, or the reference is missing? just to be able to give details to the Odin guys.
    Thanks

    Edit: just confirmed, is some sort of bug on Odin
     
    Last edited: Sep 8, 2020
    codestage likes this.
  25. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Sure, it basically finds serialized properties which objectReferenceValue is null while objectReferenceInstanceIDValue is not 0 which means instanceID reference is still present but actual object is missing, this is a missing reference.
     
  26. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    Automatically fixing a prefab for a missing component does not work for me. It seems to run, but then nothing changes...

    Unity 2019.4.10
     
  27. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hi @sacb0y, thank you for reporting this problem, I'll take a look!
     
  28. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    @sacb0y problem was fixed and update went for a review ^^
     
    sacb0y likes this.
  29. Gleb_Palchin

    Gleb_Palchin

    Joined:
    Jan 7, 2016
    Posts:
    22
    Hey @codestage !
    Not sure if it was fixed or not, but with the latest version we had an issue where Maintainer deleted all subshader graphs files even if they were used in other shader graphs.
     
    Last edited: Oct 27, 2020
    codestage likes this.
  30. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @Gleb_Palchin,

    Thank you for reporting this problem, seems to be new one, will investigate and fix it!
     
  31. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, this should be fixed for Unity 2019.2 and newer at the latest update now, please let me know if it still reproduces for you.
     
  32. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey guys, glad to let you know latest Maintainer 1.8.0 update is available and brings a bit of love to the filters:

    upload_2020-11-17_23-55-14.png

    Now Project Cleaner has Path Includes tab and every filtering tab in all modules now have "Enable" toggle against every item in the filters list allowing you quickly activate or deactivate specific filters without need in removing and re-adding them again.
     
    Redtail87 likes this.
  33. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey guys, I'm glad to let you know 1.9.0 update is live and brings a bit more UX-friendly changes to the filtering system: now you can edit filters in-place!

    1.gif
     
  34. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    317
    Is there a way for Maintainer to change references from one asset to another? I have some duplicate assets (textures, sounds, etc) that I'd like to clean up. It'd be amazing if there was a way for Maintainer to change these references to the asset I specify so I can safely remove the duplicates.
     
  35. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @Disastercake,

    Currently Maintainer has no such feature but this feature request is at the backlog already since it was requested before.

    My idea was to integrate this feature into the References Finder module (so you could replace all found references of the desired asset). Does it sounds right to you, or, maybe, you have some other idea on how it could be implemented for better UX?
     
    Disastercake likes this.
  36. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Yes that would be great please. There should be a feature for replacing references just inside references tab for easy replacement. +1 vote from my side to this feature please. This would really help decreasing our project build size since we all at some point messes things up and use duplicates but then couldn't find out where and when did we use it.
     
    Disastercake and codestage like this.
  37. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    317
    I think that sounds as expected.

    What would be needed is a simple button press to change the reference; an optional bulk "change all" feature would be a nice addition, but I'd need granular control just in case I don't want some changed.

    Even if I had to click the "replace button" manually for each occurrence that'd be better than Unity's manually intensive (and mentally draining) find-->drag-->drop-->repeat.


    If it was to be an advanced feature, I'd say "Replace References" should be it's own tab with the list of all references to that asset (populated like the references finder) and then being able to manually remove the references we don't want changed (maybe with a check box). Then pressing a single "change selected references" button that will perform the bulk action.
     
    Last edited: Dec 31, 2020
    codestage likes this.
  38. r137

    r137

    Joined:
    Mar 12, 2018
    Posts:
    47
    Hi,

    Is it possible to find null references to in addition to missing ones. May be null references which have an attribute like [Required] ?

    I am not sure if it is possible to implement such a feature or it is too much to ask.
     
  39. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @r137 , it's possible to add null fields search feature but it will find all unassigned fields in all scripts which will easily blow up issues search results since there are lots of cases when unassigned fields are should be empty by design.

    Regarding [Required] attribute - which one exactly? Is it something from .NET or from the third-party assets?
     
  40. r137

    r137

    Joined:
    Mar 12, 2018
    Posts:
    47
    Thanks for the quick response.

    I understand that there might be a lot of false positives for unassigned fields. May be filtering the search to only custom scripts solve this issue? Unity has a lot of components with use of empty fields but when game developers write their our own scripts I think components with unassigned fields with [SerializeField] attribute can be considered as a warning.

    As far as I understand there isn't a suitable [Required] attribute on dotnet for this idea. I used NaughtyAttributes and Sirenix Odin Inspector before. These two both have their own Required attribute. I guess it is hard to detect this attributes without explicitly depend on these packages. If it is possible that would be great.

    To be clear, I am talking about something like overly simplified version of odin project validator. This does a lot of checks with custom attributes. I think attributed based empty field check should be enough for a lot of cases. When there are a lot of custom scripts with connections to other scripts it is easy to miss some necassary fields. Marking these fields with attributes and checking them automaticly can be very useful.
     
  41. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    @r137
    Thank you for detailed post regarding your feature request, I'll take a look at what could be done here, perhaps null fields with any attributes attached could already work well enough for a such specific use cases.

    Added this to the internal task tracker anyways, will see what could be done.
     
    r137 likes this.
  42. ouraf

    ouraf

    Joined:
    Sep 4, 2019
    Posts:
    18
    I have a request tangentially related to what @r137 wants:

    I'm rebuilding an old Unity project and i need to manually replace missing scripts.

    Right now, i'm pulling info about the missing scripts from the .prefab and .scene files.

    For monobehavior scripts, they hold the data related to serialized fields (and pratically anything inside the script that can be interacted with in the spector)

    Example

    Code (CSharp):
    1.  
    2.  
    3. MonoBehaviour:
    4.   m_GameObject: {fileID: 1791786202475045}
    5.   m_Enabled: 1
    6.   m_EditorHideFlags: 0
    7.   m_Script: {fileID: 11500000, guid: 1dd63dc6d631c07499aad206da66e469, type: 3}
    8.   m_Name:
    9.   m_EditorClassIdentifier:
    10.   mMat: {fileID: 2100000, guid: 3d8f57cf42fe7ec4081bce5e7c804021, type: 2}
    11.   mUVRect:
    12.     serializedVersion: 2
    13.     x: 0.6254883
    14.     y: 0.05712891
    15.     width: 0.125
    16.     height: 0.125
    17.   mFont:
    18.     mSize: 20
    19.     mBase: 16
    20.     mWidth: 256
    21.     mHeight: 256
    22.     mSpriteName: Arimo20
    23.     mSaved:
    In this case, using this and other fields that i found in other prefabs i could track it down to a NGUI script.

    I've been tracking fields and other references on whatever scripts i recovered to bring it back to a bootable state. Since it's a project for 5+ years ago (Unity 5 stuff), it has become quite an archeological task.

    Checking the info on prefab and scene files is kinda slow and annoying, though.

    If possible, i'd like to ask for the "missing script" window on the addon to show some of the information stored on the prefab and other related files. If it displays (and somehow saves or export these values, because Unity might just erase all values if you replace the script with an updated version) this data, this makes the project maintenance MUCH easier.

    Right now, according to the manual, i think maintainer doesn't have this kind of option, so that's my request.

    thanks
     
    Last edited: Feb 1, 2021
  43. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @ouraf

    Thank you for the detailed feature request!

    I could try making something like this after implementing references replacement feature but did you try other available solutions for this problem, like this one?
     
    Last edited: Feb 1, 2021
    r137 and umair21 like this.
  44. ouraf

    ouraf

    Joined:
    Sep 4, 2019
    Posts:
    18
    @codestage

    I tried this one (has some weird compatibility issues with the project and doesn't show in the editor. then again, there's over 20 thousand files probably a thousand leftover scripts, so it might be that.

    I also tried DT Validator and some scripts from the old answers.unity3d, but they either hang up the editor or increase the number of errors on the project.


    Since Unity's API isn't very stable (methods are deprecated at every version and the methods meant to replace the old ones don't retain the same implementation), i'm blaming this on the editor itself. To have such feature on a well mantained and documented package is something i haven't found on the asset store so far either (hence the feature request).
     
    codestage likes this.
  45. henriqueranj

    henriqueranj

    Joined:
    Feb 18, 2016
    Posts:
    177
    Hello @codestage, first of all thank you for developing such a great tool!

    Regarding the Project Cleaner, I see a limitation where an unused Sprite packaged by a SpriteAtlas is never seen as unused. Naturally, when searching for the references of such a Sprite it is always at least referenced by the Sprite Atlas.

    Is there a workaround/feature to determine that a Sprite which is only referenced by a Sprite Atlas is actually unused? And can be cleaned?

    I understand that a SpriteAtlas can be used in more dynamic ways and thus it is not possible to be 100% conclusive that a package Sprite is used or not. However, could this be a configuration to ignore the SpriteAtlas reference of a Sprite?
     
  46. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @henriqueranj,

    Yes I think this could be implemented as an option since as you correctly mentioned stuff packaged in the atlases could be accessed from code which is not trackable statically thus by default everything references by Sprite Atlas is marked as "used".

    I've added this feature request to the internal task tracker, thank you!
     
    henriqueranj likes this.
  47. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Hi there, I just want to ask if this feature is possible or not.

    Maintainer.PNG

    See this highlighted item? It is reference by this material called "Stylize Water Diffuse.mat".
    I have a feature request, if it's possible on Maintainer developer end. This material "Stylize Water Diffuse.mat" should also show it's own references in this place. I know this material's own references are also added somewhere in this list but I feel so difficult to jump around this huge list of items. My suggestion or request, children should also show references just like it's parent (Highlighted one) is showing '1', this way we don't have to separately go and search for this material references and then come back to this object to safely remove it. Right now to check if this material is referenced by some object, I have to manually search in top search box and check it's own references and then come back to this highlighted object which is kind of hectic because sometime I forget which object was referencing this material. In my case I forgot the highlighted one. If this feature is possible please add it to next update.

    NOTE: I know this might increase searching for references time but I think this would be great. And by the way I clicked ALL ASSETS in "Search reference of: " section.
     
    Last edited: Feb 17, 2021
  48. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @umair21,

    This was initially implemented but was replaced with flat tree due to the significantly increased tree depth and overall complexity of such solution. Instead, "eye" button was added to the child items to quickly jump to their references, did you tried to click "eye" button against material?
     
  49. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Yes I did try clicking the eye button but it only gets us to the object itself in Project window and not in maintainer window. It only synchs Project window. Now to find reference of the child, either your have to search for it in maintainer window or you have to research for it's own separate reference. The point is still I get lost into the heirarchy. :(
     
  50. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Increased tree depth is much better I think. Atleast you don't have to move around in list to find the final reference. Just expand items and check it's last reference either is used or unused. Deletion could be easy with depth tree I think.