function´s question..

Hi…

I have implemented an eventManager script “js_eventManagerScript”, that script contains many functions, but not all of them are used at the same time… for instance:

function ChangeBGColor (theColor : Color){
var bgObject : GUITexture = GameObject.Find("GUI/bgObject").GetComponent(GUITexture);
bgObject.texture.color = theColor;
}

//many other functions like above

the function above is not loaded every frame and not called on Start or Awake… my question is:

is the ChangeBGColor function loaded even if i haven´t called it? because i have 25 functions in a script, they are only called in certains moments (not all the time)… but if they are wasting memory, so, i must to think in another solution.

Thanks

All your code is compiled out to a dll. This dll is loaded into memory (RAM). Whenever you call a method, it is executing the method from memory. To answer your question, yes, your method is loaded even though you haven’t called it.

ohm i see… does that means increasing drawcalls too?..

thanks

Merely having more functions does not increase draw calls.

Right thanks!