Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by trumanita · Nov 14, 2011 at 07:31 PM · memoryreduceusage

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

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image zero3growlithe · Nov 14, 2011 at 08:06 PM 0
Share

Before my Firefox died i saw many cars, how many polys has one car? And i saw many informations, is memory usage keeps growing during game?

avatar image trumanita · Nov 14, 2011 at 08:13 PM 0
Share

memory usage grows only during game loading I make many operations on texture combining, resizing, rotating them I've seen that without doing it (I need it to paint cars) memory usage goes from 3,3 gb to 1,8 gb Is there a way to deallocate memory after I've made operations on textures? thanks

avatar image zero3growlithe · Nov 14, 2011 at 08:35 PM 0
Share

How many Poligons (triangles) has one car model and how many of them is on track?

avatar image trumanita · Nov 14, 2011 at 08:52 PM 0
Share

pol 31396 verts 20352 20 cars

avatar image syclamoth · Nov 14, 2011 at 08:59 PM 0
Share

You need to make low-detail models. You should be ai$$anonymous$$g for <3000 polys for NPC cars, and <10000 for the player's car. Basically, in just one of those cars you have almost more than you should have on all the cars combined!

5 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by trumanita · Nov 16, 2011 at 10:40 AM

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 !!!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
3

Answer by ChrisSpears · Nov 14, 2011 at 09:41 PM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by TheGamedevGuru · Sep 25, 2019 at 07:32 PM

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/

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Mouton · Sep 25, 2019 at 10:14 PM 0
Share

Please don't answer questions without activity since 2011, these questions are outdated in many ways?

avatar image TheGamedevGuru Mouton · Sep 28, 2019 at 08:12 AM 0
Share

A question on how to optimize memory usage will never be outdated. Plus, it is one of the top results in google when looking for this problem.

avatar image
0

Answer by trumanita · Nov 14, 2011 at 10:02 PM

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;

     

 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by trumanita · Nov 15, 2011 at 11:38 AM

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer

How do you check texture memory usage? 0 Answers

Why Unity has high memory usage on empty scene? (Android) 1 Answer

Total Memory Target, ios devices 1 Answer

iphone variable values reset on application focus!? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges