private void OnDisable() { // Remove all cubemaps from dictionary. m_CubeMaps.Clear(); // Destroy Resources. Materials.DestroyResources(); Shaders.DestroyResources(); }
/// <summary> /// Creates and returns material from shader. /// </summary> private static Material CreateMaterial(string shaderResource) { Material material = null; Shader shader = Resources.Load(shaderResource, typeof(Shader)) as Shader; if (Util.Verify(Shaders.CheckShader(shader))) { material = new Material(shader); material.hideFlags = HideFlags.HideAndDontSave; } Debug.Assert(material != null, "Failed to created material from shader: " + shaderResource); return(material); }