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); }