x


Calling PlayerPrefs.GetInt/GetFloat every update bad for performance?

Just curious, is using PlayerPrefs once per update frowned upon? I'm currently using it to synchronize values between classes (i.e. PlayerPrefs.GetInt("Health")). If it's bad for performance I can switch to something else like a signleton or just a static int value instead. I use playerprefs a lot for many different things and now I'm starting to think that maybe it would be hurting performance and not the best thing to use for what I want..

more ▼

asked Apr 07 '12 at 06:43 AM

chillypacman gravatar image

chillypacman
201 50 64 75

Using PlayerPrefs for something else than saving and restoring value between sessions sounds wrong to me. I'd avoid it and stick to singleton/static variables, cache the manager script or anything else, really.

Apr 07 '12 at 07:03 AM by0log1c
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You'd be hitting the disk like 100 times/second for no good reason. Your other options are better.

more ▼

answered Apr 07 '12 at 07:24 AM

DaveA gravatar image

DaveA
26.5k 151 171 256

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x295

asked: Apr 07 '12 at 06:43 AM

Seen: 541 times

Last Updated: Apr 07 '12 at 07:24 AM