So I was making a mobile game using some assets from the asset store, nothing great, a few models and textures but when built it was over 150mb. I found the issue being that many of the assets from the asset store had their models and textures in a Resources folder so they were all included in the final build!
I’m going back through my other games and I find the same thing happening. Isn’t Unity supposed to check these things before assets go on sale in the store?
For those of you wondering why your builds are bigger than you think they should be it’s deffo worth checking for resources folders in your project.
How would they check it and determine if its a case of misuse? it would require a developer to analyze the package. Some assets put stuff there for no reason, some due flexibility and for the ease of use for the asset user and some for on demand resource loading to save memory.
That may be the case when developing a game but a problem with the Asset store. I’m not an asset publisher so I don’t know the details but IIRC at one point people have said that the problem is with asset store distribution/import system itself that Resources folder is the only simple way to use non referenced assets. Asset bundle configurations not being transferable and leaving to it to the users is error prone and increase the amount support.
Some art packages put stuff in the resources folder because in their demo scenes they use resources.load to find materials and stuff. Basically, an artist made a bad demo script and stuffed everything in the resources folder because he didn’t know any better.
At the bottom line you should be sharp enough to notice a bunch of garbage in resource folders when you import the package and remedy the situation.
I rarely use anything from the asset store, but if I do, I never import anything directly from the store into a project. I typically create a new project, import, clean up, then export a package. Even the best assets are often full of junk, or don’t match my own structure. It’s not ideal, but safer to just not trust any asset from the store going directly into my project.
There are cases where that’s not a good solution, though. While they might not be everyday use cases, there are plenty of legitimate cases where you might not want to or be able to pre-reference everything in advance. These are easy enough to handle when you’re doing it in your own project (because it’s not a Unity-specific thing anyway), but it sounds like that might not be the case for Asset Store products if this is the case:
I think I’m missing something here. Worst case scenario you can set up the references via an editor script. There is always a way to avoid using resources and non referenced assets.
I’m curious to see a specific concrete example where using the resources folder in an asset store product is the best option.
Why would editor scripts require Resources? Unless there is something I’m missing storing references to assets in scriptable objects is a fairly clean way to avoid Resources.
The latest fad in the asset store is assets defining constants, and asset A depending on a constant from asset B. Remove B and all hell breaks lose.
One of my games stored and shared edited levels online. To do this I had my own level assets which described what objects to load and where to put them. There was no way to know ahead of time what assets might be needed. They were all stored in the Resources folder and instantiated from there as needed.
Now, I my preferred approach to do that now would be loading AssetBundles from file locations, but it sounds like that’s not an effective option for Asset Store vendors. I could have had a script that found everything somewhere and added references to an object in the scene, but that’s a really clunky workflow that I wouldn’t want in an actual project. For the Asset Store, I’d probably implement something so that it worked with both the Resources approach and the Asset Bundles from files approach, so that people can have an example that “just works” and also have a better long term approach.
I definitely agree that the Resources thing has to be revamped. Until that happens, though…
Somebody really did that? Things are worse then I thought.
Sure. I get the need for the resources folder in general. I’ve used a similar approach myself in the past. Sometimes its just not worth the effort to build an entire assetbundle pipe line for a small project. So I suppose I’ll concede if you are selling a runtime builder on the asset store, then including a sample scene which uses the resources folder is acceptable.
That should still be very small proportion of assets on the store. Its probably workable for the asset store to ban using resources, and allow exceptions on request. Some sort of standard response along the lines of “Your asset uses the resources folder. This is not recommended. Please remove the resources folder or respond with an indication of why your asset needs the resources folder.”
Maybe I’m just being pedantic and its not that big of a deal.
Ya that’s the one case that I can think of where Resources is often the best option. I had a game with that scenario also.
Asset bundles are a pain to use. My pet peave is api’s that are not elegant and make me go through hoops I shouldn’t have to. They should have just made the api work like Resources. Map bundles to folders. Keep the api simple like Resources with just a few extra flags for stuff like async vs sync.
I have a question about proper usage of Resources folder and its alternatives. I made a simple UI system that supports i18n and themes. I thought it’d be nice if developers could see applied translations and themes in editor, so I just created a scriptable object with editor locale and theme properties and put it inside a Resources folder, along with other i18n and theme related resources.
Is it a right approach to handle such a use case? If not, what alternatives are there that I can use instead of relying on Resources folders? And if it is ok to use a scriptable object like this for editor preferences, how can I let users to override it with another instance?
Really? I believe I am now hopelessly lost on this.
…
Just went away and RTFM. Turns out resource folders inside editor folders don’t get included in a build. So yeah, useful things for editor scripts can hang out in the resources folder as much as they like. Its a far more efficient system for editor stuff then any of the alternatives I’ve considered.