I was wondering if disabling a component in the editor (unchecking the box next to the component name) results in the same performance gain as removing the component altogether?
I have some debug stuff that slows things down on the iphone, but it would be a pain to remove it and add it each time I want to test something. So I’m looking for an easier way to do it.
How are you guys handling debug for your projects? Thanks for any input.
Cheers,
-d
Performance tuning is a huge topic, obviously, and I’d search both here and on http://answers.unity3d.com/ first for a breakdown on how to best approach that for iPhone.
As far as selectively toggling debugging you have a few choices. You could have a static class and define a few different booleans that the MonoBehaviors call like:
if(DebugUtils.basicDebugging)
{
Debug.Log("Game started " + Time.time);
}
There is also the preprocessor #ifdef (define) approach, which IMO is preferred since it prevents the debug code from even being compiled into your production release. In the example above, although small, you are checking a value within a CPU cycle which could otherwise be avoided. Here’s a good thread on that topic, and both posters are ones to listen to: http://forum.unity3d.com/viewtopic.php?p=199553&sid=b5dfd467f60f27d2183dd5821235f5e4
[EDIT] Oh, almost forgot
the Unity 3.0 product is to have integrated script-level debugging (I think) so that would make all of this irrelevant, or less at least.
Thanks for the feedback. I didn’t know Unity supported #ifdef. That’s really great actually. 
The whole thing is kind of up in the air with Unity 3 coming out soon. It would be amazing to be able to step through a script. Although I don’t know the extent of the new debugging yet.
Cheers,
-d