x


840+ Texture resources in a empty project

Hi, I'm new to Unity. Just read the reference of Resources.FindObjectsOfTypeAll and tested an empty project with following code:

function OnGUI () {
GUILayout.Label("All " + Resources.FindObjectsOfTypeAll(typeof(UnityEngine.Object)).Length);
GUILayout.Label("Textures " + Resources.FindObjectsOfTypeAll(typeof(Texture)).Length);
GUILayout.Label("AudioClips " + Resources.FindObjectsOfTypeAll(typeof(AudioClip)).Length);
GUILayout.Label("Meshes " + Resources.FindObjectsOfTypeAll(typeof(Mesh)).Length);
GUILayout.Label("Materials " + Resources.FindObjectsOfTypeAll(typeof(Material)).Length);
GUILayout.Label("GameObjects " + Resources.FindObjectsOfTypeAll(typeof(GameObject)).Length);
GUILayout.Label("Components " + Resources.FindObjectsOfTypeAll(typeof(Component)).Length);

}

And I'm pretty surprised it showed 841 textures, 42 meshes (the number changed overtime), 17 materials and 7 game objects already loaded, even there was an MainCamera object visible from the Hierarchy view.

Who does know what these resources are and for?

Thanks in advance!

Jinni

more ▼

asked Feb 14 '12 at 11:12 PM

jinni_cao gravatar image

jinni_cao
1 1 1

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

This may be resource Unity uses for Editor. Try to set up new project and measure again. Or print their names.

more ▼

answered Feb 15 '12 at 12:31 PM

cupsster gravatar image

cupsster
385 6 8 15

Thanks Cupsster.

The info was printed from a purely new created project. I think you're probably right. They should be built-in resources used by Editor.

Feb 15 '12 at 01:08 PM jinni_cao

Just read the description of Resources.FindObjectsOfTypeAll

This function can return any type of Unity object that is loaded, including game objects, prefabs, materials, meshes, textures, etc. It will also list internal stuff, therefore please be extra careful the way you handle the returned objects. Contrary to Object.FindObjectsOfType this function will also list disabled objects.

Keep in mind it says "loaded", so there are some objects that might not been loaded yet but are loaded when they are requested. Also don't forget almost the whole Unity editor is made up of Unity's GUI which needs a lot textures for all the buttons / windows / icons you see.

Feb 15 '12 at 01:12 PM Bunny83

Glad you figured it out.

Feb 15 '12 at 01:19 PM cupsster
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x218

asked: Feb 14 '12 at 11:12 PM

Seen: 358 times

Last Updated: Feb 15 '12 at 01:19 PM