public virtual void Release() { if (ColorMap != null) { ColorMap.Release(0); } if (NormalMap != null) { NormalMap.Release(1); } //if (TSpec != null) TSpec.Release(2); if (EnvironmentMap != null) { EnvironmentMap.Release(4); } if (SpecularMap != null) { SpecularMap.Release(3); } if (ExtraMap != null) { ExtraMap.Release(5); } Active = null; }
private void UpdateNormalMap() { if (NormalMap == null || NormalMap.width != map.width || NormalMap.height != map.height) { if (NormalMap != null && NormalMap.IsCreated()) { NormalMap.Release(); } NormalMap = new RenderTexture(map.width, map.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); NormalMap.hideFlags = HideFlags.DontSave; NormalMap.Create(); } Normal.Apply(map, NormalMap); material.SetTexture("_NormalMap", NormalMap); }