Is there a way to know what is of all my GO, textures, sounds, etc, are not in use in all scenes, to delete it?
When i tested my game, I have inserted some textures, sounds, GO etc and some of them are not in use.
I'm using Unity 5.1.1.
2018 ..
The modern solution is simply ..
Click on your scene(s) and select "Select Dependencies".
It will show you what is used; the rest is unused. Really it's that easy.
As with many things in Unity pipeline, it is very common to use an asset, virtually every project uses a few well known assets. "A+ Assets Explorer" (link) is very common.
When Unity builds the executable, it does so only with required assets. Anything else that might exist in your scenes or projects is simply ignored.
This answer over on Unity Answers has more info.
There are also options available in the Asset Store, such as this one.
Asset Hunter is a tool that analyzes your buildlog and gives you an easily understandable overview over unused assets in your project folder.
The results are grouped into folders and file types, making it easy to start cleaning up your project.
Related
I created a mini game using Unity and built it a few months back. It was just a pet project so I deleted the project file but still have the built/compiled game. In the project's ASSETS, I put a text file with some notes that I had created for myself and some scripts.
Is there a way to extract or even just see the text file from my built game? Is there a way to extract all the assets or something?
I'm extremely new at this kind of thing so unfortunately, I don't really know the right way to ask the question or find it on google. Any help would be appreciated.
Thank you.
Probably not
That text file, if it wasn't used as an asset, isn't going to be in your compiled game anyway. But even if it was, finding it and extracting it would be difficult due to the semi-obfuscated nature of dlls and how Unity compresses and builds assets into dlls.
If you want to make the file accessible post-build by design, use StreamingAssets folder.
Otherwise you'll have to rely on 'uglier' methods as mentioned by Draco18s (people steal assets all the time so it's not impossible).
what's your building platform ?
if it's android then you can get a look at the scripts and other text files using ILSpy.
Just change the .apk to .zip
Unzip, and open the compiled files in ILSPY.
When I build/enter play mode in the Unity IDE, many warnings clutter the console window that have been generated by script compilation of 3rd-party assets. How can I disable or hide the console warnings from specific assets without making changes to those assets?
I anticipate people righteously howling about how I need to fix the warnings instead of sweeping them under the rug. But to those folks, please consider...
The code is in 3rd-party assets--not mine. Typically, no upgrade on the asset is available that would fix the messages, and I've reviewed the messages and judged them to be benign. I realize the value of warnings, but I don't want to dig into 3rd-party code to fix the warnings. I'm also reluctant to change the code in these assets because it essentially gives me a local fork. And then future updates on the asset from the 3rd-party will need to be hand-merged against my local updates. That's time-consuming and introduces risk.
Two years later, I can answer my own question. :)
Create .asmdef files such that third party assets are in one manifest, and all project code is in a separate .asmdef. So in my project, I keep the 3rd-party assets just under Assets with project one level down.
Assets (folder)
thirdPartyAssets.asmdef
...other files and folders...
Project (folder)
project.asmdef
...other files and folders
This basically "disables" warnings from 3rd-party assets by simply not building them. You will still see 3rd-party build warnings if those assets change or a clean build is made.
The original question was how to disable for specific assets, so I'll note that it's possible to arrange the .asmdefs to include/exclude assets in different groups. And simply putting an .asmdef into the folder of one asset that warning-spams, will cause that single asset's warnings not to be shown except for the cases I described in the previous paragraph.
Put the plugin into its own folder and make an assembly definition if there isn't one already.
Then you need to create a csc.rsp text file alongside the assembly definition
Edit this csc.rsp and add this line
-warn:0
This will set the warning level to 0 (no warnings) for that assembly only.
see https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/errors-warnings
Thank you to both Erik Hermansen and Adam B for providing solutions.
I went with Erik Hermansen's solution, but modified it slighty, sort of the other way around :) :
moved all third party stuff into a folder Assets/ThirdParty, and created Assets/ThirdParty/ThirdParty.asmdef
kept my own stuff at top level, and created Assets/MyAssembly.asmdef
Note that you probably have to add some references to each assembly:
MyAssembly.asmdef:
ThirdParty.asmf
Unity.TextMeshPro
ThirdParty.asmdef:
Unity.TextMeshPro
(maybe some others, depending on your own project)
In editor, the meta file records reference with other asset, so I think when build assetbundle, I need to include the .meta file also, so at runtime the asset will find the reference with each other.
But according to this link https://answers.unity.com/questions/910422/assetbundleloadmainassetatpath-not-loading-meta-fi.html , the answer said there is no need for it, I'm confused about that
From what I know, Unity uses these .meta files in the editor only. I'm pretty sure that the asset bundle contains data that tells it what files do what. The guy at the link you've posted seems to be pulling .meta files from the asset bundle and I don't think this is the correct way to do this, since you are basically doing it in the reverse of what unity was designed for. Try finding only the assets you are looking for, not the meta files. Also you should not have to manually include .meta files in your asset bundle, unity should do this automatically. And one last thing, Use unity's built in functions for accessing asset bundles rather than System.IO, since the system does not know what an asset bundle is, only unity does. Once the files are extracted onto your drive, then use System.IO on them.
Good luck.
Unity's .meta files contain two important pieces of information:
The GUID that Unity uses to track any references to the Asset.
The settings for the Asset that you see in the Inspector window.
Hence, if you don't include them you risk breaking references and losing Asset settings.
This article on my blog explains meta files and GUIDs in more detail.
I would like to use a lot of 3D models more than 4000.
The folder can be at least 20GB size.
When I opened this folder with Unity editor, it freeze my Unity engine and Jetbrains Rider as you thought. However, these models is no reason to be loaded in every time since several models being loaded is determined in dynamic on runtime.
I think I can make use of AssetBundle feature to load these model in dynamic. However, I think that limit assets must be placed in Assets folder to build as asset. That can freeze my editor and Rider.
But technically, I think AssetBundle must be able to be build in separately.
How can I solve this problem?
You can indeed use Assetbundles to fix this issue. If you have all your models build into assetbundles you can store the assetbundle file and assetbundle.manifest on a remote server or FTP and just download it at runtime whenever you need the asset. this way the models will never be in your build project and can even be in a seperate unity project, solving your crashing issues on your main project.
For my answer i'll be assuming you are using Unity's new Assetbundle browser tool and using a Unity version that is higher than 5.6. If you do not have the new Assetbundle browser here are some quick steps to get it:
Download the AssetBundle Browser tool from Unity's GitHub
Add the downloaded files to your Unity project's /Asset/ folder
Go to Window > assetbundle browser
a quick tutorial can be found here
Building the bundles
The benefit of using assetbundles for this is that, as long as the Unity versions match, they can be build from seperate projects. Therefore i would recommend creating a new empty project and testing how many models you can have in that project without crashing Unity.
Once you have found that limit create prefabs out of the models, and add them to the Assetbundle browser tool.
Set the target platform for which you want to build the assetbundles and the compression you want to apply to in the "build" secton of the assetbundle browser tool. once you have done that hit "build" to build your assetbundles.
Once this process is completed you can take the assetbundle file and assetbundle.manifest and upload them to a seperate server or FTP that the client can connect to at runtime to download the required assetbundle, containing the desired model.
Since the new Assetbundle browser tool is open source you can also automate the process of uploading the assetbundles directly after they have been build.
another benefit of this is that the assetbundle browser will detect any shared assets (e.g shaders, scripts) and give you the option you move them into a shared assetbundle that only needs to be downloaded once, and any following assetbundle can call. This way you won't have to keep downloading shared assets.
Building assetbundles is quite a time consuming task (also depending on the target platform and compression settings) so if you have the resources available you might want to do this on multiple computers at once.
You may try to exclude folder from being indexed.
https://youtrack.jetbrains.com/issue/RIDER-8664#comment=27-2399808
I think the best way to fix it is simply not using so many models.
So simple.
You should choose models that will fit best for the rest and just create few diffrent texture for each model.
Its like in the movies. You dont need 2000 ppl to make crowd. You just need 20 different ppl and copy paste there in CGI.
This may sound like a bit of a silly question- but do any of you have any "preferred" methods of keeping a large iPhone/iPad project organized? More specifically, any type of strict directory/layout structures?
I know this question has been asked before in the context of something like an Xcode project- but what I'm wondering is what would be the best way to organize and keep an -entire- project clean and tidy. This includes other assets that are not directly used by Xcode, but otherwise exist as they are used to generate the assets that get included in Xcode (ie, Logic Pro tracks, Cinema 4D scenes, meshes modelled up in Modo, PSD and AI source files, etc...).
Some of our larger projects are getting a bit disorganized and difficult to make sense of, which is why I'm asking. I want to implement some sort of strict directory structure that everything will eventually adhere to (apart from the things already sitting in source control). We deal with multiple programs for the various assets that get used by Xcode to produce the final game- so it isn't unfortunately as simple as just tossing everything in the Xcode project folder and calling it quits.
Cheers,
-CMPX
I like to follow a Rails inspired layout:
App (AppDelegate and stuff)
Controllers (All the controllers)
Views (All your XIB's)
Models (All your models)
Libraries (all Apple and 3rd party stuff)
Images (static images)
HTML (for local webviews and stuff)
...
Works for me :)
For me, I keep two separate folders 1 for the Xcode project with all the final assets. The other folder external to the Xcode project folder is the art asset folder where I create all the graphics and later import them into my Xcode project.
In the Xcode project, I create separate folders for different types of assets such as classes and images, audio files, textures and so on.
We found that separation as Apple suggests by default on models / views/ controllers (in different folders) is not sufficient. We are trying to keep structure workflow / functionality oriented but flattening the structure of a project to keep all layers of an app visible for further code reuse. All XIB files usually kept in the same place with code files to make it simple to modify solution. All resources are divided by types at the top level and by workflows / functionality underneath.