Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 siddharth3322 · May 17, 2018 at 11:17 AM · transformscript.updatemovement scriptexecution order

Define execution order of same script on multiple gameobjects

I have same scrolling script attached on multiple game objects. But I want they executed in sequence. At present they were executing, I can say randomly so they can't able to achiever synchronisation with each other in order.

So I want they executed based on each gameobject's order rather then each one randomly selected. Please give me some help into this.

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

2 Replies

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

Answer by Koyemsi · May 17, 2018 at 11:31 AM

Hi. I think one way to do this would be to make an object working like a level manager, in order to control the execution order. So you would have an empty GO with a script (the level manager) where you would store a List of all your scrolling GOs. This manager would sequentially control these objects, by allowing their script, or calling their scrolling method at the right moment.

Comment
Add comment · Show 2 · 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 siddharth3322 · May 17, 2018 at 11:34 AM 0
Share

Yes I understand your point but what if I want to assign individual script to each gameobject. Any way possible for this ?

avatar image Koyemsi siddharth3322 · May 17, 2018 at 12:06 PM 0
Share

No problem, as far as I understand what you mean exactly. In my idea, each of your GOs has its own individual script (the scrolling script). The level manager GO would only list these GOs, and activate their scrolling scripts in the order you defined. Or am I missing something ?

avatar image
2

Answer by KaspianR · May 17, 2018 at 11:55 AM

I think you could just move your code to another function

 public void FunctionName(){
     //code goes here
 }

Then you can just make another script and put it on empty GameObject. The script should look something like this:

 public YourScriptName[] scripts;

 void Update(){
     
     foreach(YourScriptName script in scripts){
         script.FunctionName();
     }
     
 }

Now, just add the scripts to the Array in the order you wan't them to be executed and it should work!

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 KaspianR · May 17, 2018 at 11:58 AM 0
Share

If you wan't to more easily edit the order during runtime replace the first line in the second script with:`public List scripts;` I would actually recommend a List ins$$anonymous$$d since they are easier to work with overall!

avatar image siddharth3322 · May 17, 2018 at 12:04 PM 0
Share

Yes I am getting your point clearly :) Let me try to implement and check...

Thank for your side quick reply.

avatar image KaspianR siddharth3322 · May 17, 2018 at 12:05 PM 0
Share

No problem, good luck!

avatar image siddharth3322 · May 17, 2018 at 12:27 PM 0
Share

You both talking about same point so I have up voted your answer and marked as correct first replied answer... Please keep supporting always..

avatar image Koyemsi siddharth3322 · May 17, 2018 at 12:31 PM 0
Share

Thanks for the vote. I've also upvoted @$$anonymous$$aspianR because its answer would also deserve to be "best answer".

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

112 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Problems with a quad dimensions 0 Answers

The position of the object and its changes! Help me can not understand! 0 Answers

Rotate Method via Update ? 2 Answers

future updates 0 Answers

Trying to rotate child independently of parent... 0 Answers


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