Question by
ow3n · Aug 31, 2017 at 12:26 PM ·
c#iosmemoryfindobjectsoftypeall
On build only, FindObjectsOfTypeAll does not exist in the current context"
I am removing textures from memory (loaded from Resources) using Resources.FindObjectsOfTypeAll(). My script works fine in the editor
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
public class AppController : MonoBehaviour {
public static void RemoveAllTexturesFromMemory(){
// find all loaded textures
Texture2D[] ts = FindObjectsOfTypeAll(typeof(Texture2D)) as Texture2D[];
Debug.Log("Number of all loaded Textures " + ts.Length);
// remove based on name here ...
}
}
...but when I attempt to build I get the following error:
error CS0103: The name FindObjectsOfTypeAll does not exist in the current context
What could be causing this issue?
Comment
Best Answer
Answer by ow3n · Aug 31, 2017 at 03:58 PM
I found my error thanks to a friend who pointed out that I should be using Resources.FindObjectsOfTypeAll()