How to find non-mobile shaders going to android build

I started from standard shader and I know that not every material in project was switched to mobile. But I have more materials in project than go to build , because a lot of materials are not used (or I believe so).

How to find non-mobile shaders going to android build?

Really noone needs that or noone knows the answer?

Your question is unclear. What is exactly a “non-mobile” shader? Shaders are not categorized into mobile or non-mobile, sure some of them have name “Mobile” in them, but that only means that it was created with optimization in mind for mobile.

You can try to call https://docs.unity3d.com/ScriptReference/Resources.FindObjectsOfTypeAll.html pass Shader as type, and then iterate through them and check the name. Not sure if that helps you.

Ok, let say I need to list all materials going to android build with shader names
How to do it?

I am not sure such function is exposed, only available way is to query objects at runtime with Unity - Scripting API: Resources.FindObjectsOfTypeAll

I may have been wrong, BuildPipeline.BuildPlayer returns BuildReport file, it also contains what exactly was going into build, try exploring its contents. But that also means, you need to build via scripting API

Wow, thanks!
But maybe it would be easier to list just all materials in scene?

I don’t think that will list everything, I mean let’s say you only instantiate a prefab with specific material during the gameplay. If you’ll list materials during Edit mode, it will not show up

If in runtime?

That would probably work, still, there’s no magic function for this, you need to list it yourself.

Do you mean I need to modify this script to typeof Shader and just print everything found?
That would give me shaders, but how to find materials used?

Otherwise,if i search for type materials and print that list, is it possible to print material.shader name too?

And how to search in scene prefabs? Comments in script tells it doesn’t examine prefabs…

public class ExampleScript : MonoBehaviour
{
// This script finds all the objects in Scene, excluding Prefabs:

List<GameObject> GetAllObjectsInScene()
{
List<GameObject> objectsInScene = new List<GameObject>();

foreach (GameObject go in Resources.FindObjectsOfTypeAll(typeof(GameObject)) as GameObject[ ])
{
if (go.hideFlags == HideFlags.NotEditable || go.hideFlags == HideFlags.HideAndDontSave)
continue;

if (EditorUtility.IsPersistent(go.transform.root.gameObject))
continue;

objectsInScene.Add(go);
}

return objectsInScene;
}
}

This is an editor script, I meant you need to run your script from inside the game, when running on Android