x


Profiler most expensive value is GameObject.set_active()

In profiler I see that the most expensive value is GameObject.set_active() which is called when I'm activating objects (it shows about 30% of work of several hundred lines script). Why is it so? Is it possible to reduce it somehow?

Platform: iOS.

more ▼

asked Jan 21 '11 at 10:15 PM

Santa gravatar image

Santa
477 20 24 37

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

If you can disable all the components on an object, do that instead (Cameras, Renderers, Scripts...). You can't do this for colliders, but you can make them into triggers, if they hadn't been. If there's some component/logic combination that actually requires you to deactivate the game object, then there's nothing you can do about it. Try to code around that; I find that the disabling and trigger switching method is usually suitable, but it obviously depends on what components you're using.

more ▼

answered Jan 21 '11 at 11:05 PM

Jessy gravatar image

Jessy
15.6k 72 95 196

(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:

x154
x112
x1

asked: Jan 21 '11 at 10:15 PM

Seen: 595 times

Last Updated: Jan 21 '11 at 10:15 PM