- Home /
loadedlevelname vs loadedlevel
Sorry if this is a noob question, but i was wondering, since loadedlevel compares ints instead of strings as in loadedlevelname, is it any faster?
Even if it's negligible, mainly out of curiosity, is my thinking correct?
Thanks in advance.
Update: For example,
if(application.loadedLevel == 1)
vs
if(application.loadedLevelName == "MainMenu")
Answer by rutter · Feb 21, 2014 at 01:46 AM
Int comparisons are faster than string comparisons, but this sort of check is run rarely enough that the difference is usually irrelevant.
Use whichever makes more sense for you and your project.
Thanks, just wanted to be sure, wasn't sure if there was any compiler optimization or anything. Also, By any chance, do you know how much faster? say, for example, half the time?
Your answer
Follow this Question
Related Questions
Is OnControllerColliderHit bad for performance? 1 Answer
Improving Performance of Map Loading 1 Answer
Tracking cpu usage and memory for Web Player 1 Answer
CPU being choked by GC.MarkDependencies 1 Answer
GUI alternatives ? 1 Answer