Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by robinking · Feb 03, 2011 at 09:44 PM · iphoneoptimizationupdate

Can an object script NOT contain Update()?

If I have a GameObject with three scripts attached to it, do all three scripts have to have an Update() function? Can 1, 2 or even all 3 have no Update() at all but just normal called functions, maybe that are called by another script attached to another GameObject?

And if so, does it make any difference? I read somewhere on another forum that for iPhone optimisation, it's better to have one function to affect a whole collection of objects, rather than each of those objects having its own little Update()...

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by e-bonneville · Feb 03, 2011 at 09:49 PM

No, none of the scripts on your GameObject have to include an Update() function.

The memory cost for ten Update()'s is really affected by what you do in it. Alone, it's minimal, so I wouldn't worry about it.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image robinking · Feb 03, 2011 at 10:25 PM 0
Share

I see. Does an empty Update() function actually cost some performance? Over and above a script with lots of called functions but no Update() function? (if I had thousands of instances, for example)

avatar image e-bonneville · Feb 03, 2011 at 10:28 PM 0
Share

An empty Update() function costs next to nothing, because you're not doing anything to use up memory in it. Even if you did have thousands of instances, the memory use is still tiny and not worth worrying about. ;)

avatar image Eric5h5 · Feb 03, 2011 at 11:06 PM 0
Share

That's not really true; an Update call does have overhead, and should be removed if you're not using it. Thousands of objects with empty Update functions will have a noticeable performance hit an an iPhone (not that you'd want thousands of objects on an iPhone to begin with).

avatar image robinking · Feb 04, 2011 at 12:12 AM 0
Share

Cool, thanks for the info!

avatar image e-bonneville · Feb 04, 2011 at 12:33 AM 0
Share

Thanks for clearing that up, Eric. I've not worked with iPhone before, so my experience is solely with high-end platforms. As a result, I don't know a whole lot about iPhone optimization.

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Making a GetComponent array 1 Answer

Efficiency of Game Loops 2 Answers

help with iphone 3GS performance (polys and audio) 2 Answers

Large level loading best practices 1 Answer

Colliders vs RayCast (automatic crosshair aiming in an FPS game) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges