reduce memory usage

hi,
I’m developing my first work in unity3d
the problem is that memory usage is too high (over 3gb)

GAME

any suggestion to reduce memory please?
thanks in advance
bye

I think I’ve solved
I share it for those could have the same problem
During loading of resources I call

Resources.UnloadUnusedAssets

Now ram usage is at 0,7 gb !!!

High polygon counts use some memory but not GBs! We obviously don’t have enough information to diagnose this issue but my money is on high-res (4K x 4K maybe?) textures that they are making unique for the cars. Make a copy to paint the number of the car. Do that for 20 cars with a spec and a bump and you’ve got:

4096x4096x4 bytes (32 bit RGBA)x 3 (spec, bump, diffuse) x 20 cars = almost 4GB

If that is the case, either apply the number as a separate texture, use smaller textures, or only paint the number in a smaller portion of the model so it is just a small chunk of the car.

Again, without more information we are all just throwing darts so any more information would be super helpful.

first of all, thanks to everybody
my textures aren’t so large (max is 1024x1024, but I usually use 512x512)
I paint cars dynamically depending on data loaded and I make many operations on textures (I suppose this is the problem, because using models as loaded without painting them, memory usage goes from 3,3 gb to 1,8 gb
I use code like this:

				public static Texture2D CombineTextures2 (Texture2D aBaseTexture, Texture2D aToCopyTexture)

{

	int aWidth = aBaseTexture.width;

	int aHeight = aBaseTexture.height;

	int cWidth = aToCopyTexture.width;

	int cHeight = aToCopyTexture.height;

	Texture2D aReturnTexture = new Texture2D (aWidth, aHeight, TextureFormat.ARGB32, false);

	Color[] aBaseTexturePixels = aBaseTexture.GetPixels ();

	Color[] aCopyTexturePixels = aToCopyTexture.GetPixels ();

	Color[] aColorList = new Color[aBaseTexturePixels.Length];

	int aPixelLength = aBaseTexturePixels.Length;

	int row = 0, column = 0;

	for (int p = 0; p < aPixelLength; p++) {

		row = p / aWidth;

		column = p - row * aWidth;

		//if(row==242)Debug.Log(aToCopyTexture.GetPixel (column , row));

		//aColorList[p] = Color.Lerp(aBaseTexturePixels[p], aCopyTexturePixels[p], aCopyTexturePixels[p].a);

		if (aToCopyTexture.GetPixel (column , row).a >0 ) {

			aColorList[p] = aToCopyTexture.GetPixel (column , row);

			//if(row==242)Debug.Log("sost");

		} else

			aColorList[p] = aBaseTexturePixels[p];

	}

	aReturnTexture.SetPixels (aColorList);

	aReturnTexture.Apply (false);

	return aReturnTexture;

	

}

I’ve found a partial workaround:
in my CombineTextures method now I do:

aReturnTexture.Compress(false);
aReturnTexture.Apply (false,false);

I’ve reduced memory usage from 3,5 gb to 2 gb (still not completely satisfied)
Any suggestion is still welcome
Thanks

Give Unity Addressables a try. It’ll help you with asset lazy loading, while still keeping the references workflow. Plus, it’s really easy to upgrade. I wrote an extensive tutorial on Unity Addressables: https://thegamedev.guru/unity-addressables-learn-workflows/