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 ErikH2000 · Jun 25, 2014 at 08:54 AM · updatestartarchitecturebestpracticesupdate-order

Use my own update() and start() methods.

I would like to use my own update() and start() methods which would be called directly from a root GameObject that has the expected Update() and Start() methods that Unity calls for MonoBehavior-derived classes. Unity would call Start() of the root game object, and the root game object would store references to the other objects in the scene that need scripted behavior, and call setup methods on those objects. And Unity would also call Update() of the root game object, and the root game object would directly call an update method (named differently than "Update") on the other objects. Unity would not call start or update on any scene objects except for the root game object.

For my project, the advantages are as follows:

  • Complete control of the sequence of calls

  • Ability to pass data efficiently as parameters of the direct-called start and update methods.

  • Access to the complete call stack in the debugger that shows me what has already executed at any point.

What are the disadvantages?

  • Some extra coding work in setup to find objects and store instances to them for later calls. (For my project, I don't care about setup running slow--just update.)

  • Maybe the scripted code that calls methods directly is slower than native code in Unity?

  • Maybe Unity is trying to get some work done between individual calls to MonoBehavior.Update and Start? And a single monolithic start() and update() call chain will impact performance?

I dunno. What do you think? Bad idea?

-Erik

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
-2

Answer by coldwar98 · Jun 25, 2014 at 09:21 AM

well i dont know what space ship u r making,if u can tell what ur primitive script wants to do i can bet u can do it without these strnge requirment. most u can do without coding is to add ur script to Project settng>script execution order . as far as passing parameters are concerned u can use playerPref function it is life saver. Good luck!!!

Comment
Add comment · Show 1 · 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 ErikH2000 · Jun 27, 2014 at 02:35 AM 0
Share

Coldwar, somebody else modded you down, sorry. But I don't think you've understood the situation I've described very well. There are lots of things I can do that will work, including setting script execution order as you suggest. The architecture I proposed works too. It is a question about what is BEST and WHY? Also, when you say "I don't know what space ship u r making," it doesn't hurt my feelings, but a more useful thing is to comment on what part of my question you don't understand so that we can have a constructive conversation.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Prevent update until child script start completes? 1 Answer

Script variables resetting on play 0 Answers

C# void names 1 Answer

How do I use iTween outside of start? 0 Answers

bool value does not change 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