1024x1024 Texture2D Takes up over 8MB of memory
Noticed that 1k Texture2D when created in code takes up over 8MBs in memory where I would expect it to be 4MB.
So far researching I came up that reason to that would be because texture is read/write enabled and that it should go away once Texture2D.Apply(false, true) is called to make it no longer readable. But after calling this, even trying to call GC nothing changes memory usage does not decrease, tried in empty project used this code:
using System;
using UnityEngine;
public class TextureTest : MonoBehaviour {
private Texture2D tex;
void Update() {
if (Input.GetKeyDown(KeyCode.Space)) {
tex = new Texture2D(1024, 1024, TextureFormat.ARGB32, false);
tex.Apply(false, true);
Resources.UnloadUnusedAssets();
//GC.Collect();
//GC.WaitForPendingFinalizers();
Debug.Log("Created texture");
}
}
}
Anyone knows why is this happening, is there something else that should be called?
Comment
Your answer
Follow this Question
Related Questions
Help Textures ?? inserting texture @ como inserir texturas 1 Answer
2D advanced texture blurriness 1 Answer
Change Texture 0 Answers
Texture maps in Unity Asset Store 0 Answers