Search Unity

Where to Install Your Assets (for Scripting Packages/Editor Extensions)

Discussion in 'Assets and Asset Store' started by SonicBloomEric, Jan 21, 2015.

  1. DerDicke

    DerDicke

    Joined:
    Jun 30, 2015
    Posts:
    292
    Your customers don't have to know about Asset Tags at all. Packages that support your package would have to. Your package could use them. If you don't need them, ignore the whole thing. Of course there must be a editable list of all defined Asset Tags for the project.
    People will use common reasoning and will not break your Tags. Why should they? Its like deleting a script and complaining that nothing works anymore. What can you do about that?

    As I said, this is a terrible idea. There is no uninstall system in Unity. If a user doesn't like your asset anymore, she just deletes your asset folder. Therefore having your stuff cluttering the whole project isn't a spectacular fun experience. People will start throwing things at you. And they are right.
     
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Well they might want to also type the name of your plugin in the Project View after doing that so they can find the other remnants inside Gizmos / etc and delete those too. Common sense for me.

    If you have files that are supposed to be used by those magic folders and choose to ignore and not use them, don't be surprised when people throw things at you. Not using Editor Default Resources folder means your custom Inspector graphics would be included in a build, which is terrible!
     
    SonicBloomEric likes this.
  3. DerDicke

    DerDicke

    Joined:
    Jun 30, 2015
    Posts:
    292
    You might instead use any Editor folder in your package.
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I was talking about graphics, not scripts. That special folder is meant for graphics that never get exported and only are of use inside Unity IDE.
     
  5. SonicBloomEric

    SonicBloomEric

    Joined:
    Sep 11, 2014
    Posts:
    1,088
    That is not what I said. What I said was that "if a user edited-or-removed your custom tag or label" then it would break. This is more esoteric and less obvious than using the Special Folders. When things break, they would break in asset-specific ways. These also do not handle compilation today, so they do not act as a 1-for-1 swap.

    If you are describing a completely new concept in "Asset Tag", then that is a different conversation and one that would be best spent as a suggestion or bug.

    Have you ever worked on a team project? Not everyone is aware of every asset in the system. Lots of people will attempt to control and organize their Tags, just like they do with folders. I speak from experience on this (both as someone who did tag cleanup myself on a team and someone who had stuff break due to another person editing tags on a team project). Tags are no more "solid" a solution than folders.

    We have never had a user write to us in confusion or anger or anything else asking for help on uninstalling assets set up in this manner. We have used this setup for three-going-on-four years now and not once have we had a complaint.

    As @jerotas pointed out, if you search for the asset name in the project view, you should get all the root folders for the assets (provided you followed the structure recommended in this thread). Deleting them should be enough to clear out most/all of the content.

    This is another area that will theoretically be improved once Asset Store assets are delivered as [Package Manager] Packages.

    This is only true as of Unity 5.1, which is admittedly quite old by now. However, if you look at the code behind that call, the fact that EditorGUIUtility.Load can load from "any Editor folder in your package" (it can actually load from any folder in your package, period), doesn't mean it's the "correct" or "best" way. If you take a look at the code behind that call (using Assembly Browser or equivalent), this is how the function works:
    1. Check for the asset in Editor Default Resources.
    2. Check for the asset in the built-in Editor Asset Bundle.
    3. Fall back on AssetDatabase.LoadAssetAtPath. (← added in 5.1)
    By using Editor Default Resources you get the fastest possible load time. This also happens to be the approach suggested and recommended by Unity engineers on the Editor team.
     
    jerotas likes this.
  6. DerDicke

    DerDicke

    Joined:
    Jun 30, 2015
    Posts:
    292
    Just released an asset having a custom Inspector using a texture located in my Editor folder. This works.
     
  7. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok, and why exactly would you want to do it that way when there's a special folder for those things?
     
  8. SonicBloomEric

    SonicBloomEric

    Joined:
    Sep 11, 2014
    Posts:
    1,088
    Yes, it will. It is also leveraging a fallback that Unity added in 5.1. Unless you use the generic AssetDatabase.LoadAssetAtPath directly to load your asset, rather than the EditorGUIUtility.Load function then you are doing a lot of extra work for nothing.

    It is also possible that Unity optimizes the Editor Default Resources APIs as you can make certain assumptions about assets that are used by Editor GUI that you can't for generic assets in the project. For instance, I believe I heard somewhere that Unity preloads all assets in the Editor Default Resources directory when the Editor starts, which will make things a bit snappier.
     
  9. CrystalConflux

    CrystalConflux

    Joined:
    May 25, 2017
    Posts:
    107
    Has anyone heard any updates on this recently? I assume that once this happens we'll have to update our assets to work well with the package manager.

    Edit:
    Found this thread – https://forum.unity.com/threads/plans-for-assetstore-packages.652297/
    Essentially it's in progress.
     
    Last edited: Apr 2, 2019
    SonicBloomEric likes this.
  10. SonicBloomEric

    SonicBloomEric

    Joined:
    Sep 11, 2014
    Posts:
    1,088
    I spoke with some folks on the show floor at GDC 2019 (two weeks ago) about this. Unity is currently working out the details on how this should work with their own internal packages. It's still so early that they wouldn't hazard a guess as to when Package Manager-based delivery for Asset Store assets would be a thing. The conversations left me with an impression that they've still got a bunch of hurdles to work out before opening it up to non-Unity people.

    Those I spoke with did say that they wanted any transition between systems to be as straightforward as possible when they do open it up to Asset Store publishers. There was general skepticism, however, that it would be as simple as a button press.

    To sum up: it's still too early to tell, unfortunately.
     
    CrystalConflux likes this.
  11. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    1,305
    slightly off tangent: there might be something something nuget (visual studio only though):
    https://twitter.com/jmillerdev/status/1112773144346087430

    but neither of these two ( this and potential asset store packages ) directly concern any package structuring in the project, so..
     
    SonicBloomEric likes this.