Device [Ram] check

What’s up everyone, first let me finish with as always stay productive!!!

Topic - RAM Check

OK here’s what I’m looking to do:

I’m looking to create a small block/method to return the current system RAM and based on that limit certain functionality within the app (current target Android).

Having it where users are not allowed to download the game is bad for business just as well as the game crashing due to lack of RAM when certain functions get called.

As of now the two most expensive calls within the app are run Ads and IAP initialization.

Is there a way for me to add a check RAM before call method or line within the call method, and if RAM is sufficient execute , if not prompt user your device does not have enough RAM for this.

That way users with less RAM can still play the game. Users with more RAM wont miss a beat and me on the end of Development/Business won’t loose sleep and half a brain over this matter…

I’m not looking to leave anyone out here!!!

Have anyone developed a solution of such or can anyone point me in the proper direction to achieve this.

Thank you.

–Grand Rio

I would start here…

Thanks and I seen that along with several other post and also I looked it up in the uDocs as well before posting. When you arrive there and select “see Also: SystemInfo.systemMemorySize” or “see Also: SystemInfo.graphicsMemorySize” they loop to one another…???..??

also would I need a certain namespace to access this or…

Do I go…

public int deviceMem;

public int deviceMemNeeded;

public Awake()
{
deviceMemNeeded = 2048;

//this
deviceMem = SystemInfo.systemMemorySize;
//or
deviceMem = SystemInfo.graphicsMemorySize;
}

public int returnMem(){
int mem;

mem =  SystemInfo.systemMemorySize;

//or

mem =  SystemInfo.graphicsMemorySize;
return mem;
}

public void callMethod(){

if(returnMem() < deviceMemNeeded ){
// prompt you do not have enough RAM for this action

return;

}else{
//execute... do something
}
}

Do you have even a single datapoint indicating you have a problem with users exceeding the available RAM?

Don’t waste time trying to solve problems you probably don’t have in the first place. Instead, focus on making more games and making the ones you have more fun.

2 Likes

Devices with 1024 or less RAM seem as thought they can’t handle the Ads and IAP call functions. Yes several phones that I test with will shut out and restart, They one that it works fine on has 2048 RAM it’s the others…

All I’m looking to do is get device ram, if it’s less than 2048 disable ads and IAP , by doing so this will still allow users to play the app (where is the fun if you can’t even run the app???)

1 Like

@TSC Did you ever get this figured out? Sorry about the Kurt guy, what a rude person :frowning:

3 Likes

Maybe you can answer the question: what is it not clear about the static accessible variable Unity - Scripting API: SystemInfo.systemMemorySize ?

The most info I found is SystemInfo.systemMemorySize is the total memory that should be on the phone. Apparently it also doesn’t work on some phones like Note, where it returns incorrect information: SystemInfo returning wrong values on Note3 and newer devices

And where do I look if I want to find the total memory AVAILABLE, not used? Maybe systemInfo.graphicSize?

Honestly, I’m a bit lost here. I would appreciate any help, thank you!

That’s kind of the name of the variable. It is self-explanatory.

That I don’t know. If you experience that it is buggy, submit a bug report, I’m pretty sure Unity Engineers would like to fix it if it isn’t working properly.

It is not related to the question. AFAIK Unity doesn’t provide such an information.

??? Why would it be? Why would be the available >system< memory called >graphicsMemorySize<?

And at both variable the documentation clearly tells you what they are representing. (eg: "Amount of video memory present " at the graphicMemorySize).

Now if you think there is no available method to get the available system memory on a device, and you think it is possible, and you think Unity should provide such information (I doubt that it would be the best strategy, personally, but that’s my opinion only), then you should open a new thread in the relevant Platforms topic (eg, iOS, Android, whatever) and mark it as “feedback” (next to the title when you edit your new thread). We can ask for features this way for a while now.

Sorry for the late response but yes I did, yes in the pre-loader do a device check ram or any thing else then just enable or disable certain features according to the device capabilities, all the while updating(prompting) the user ,-" you can get more features if you update your device"… but yeah