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 /
  • Help Room /
avatar image
0
Question by akashif · Aug 15, 2017 at 10:12 AM · performanceupdate functionstartcoroutinemultithreading

Suggestion Needed to Move Several Objects ( Logic only)

HI

I am in process of creating a mobile game where I need to move many object at the same time.

Background:

  1. I touch one OBJECT_1 and Drag it to a position(vector2 position)

  2. ON_FINGER_UP , Object start moving towards the position(vector2 position)

  3. While OBJECT_1 is still moving I moved OBJECT_2, and it started moving as well.

I have several object which a user can move with finger (players). Along with some automated moving objects on a certain path (enemies)

Motion is not Physics based i am using following :

 transform.position = Vector2.Lerp(transform.position, distPoint, Time.deltaTime * speed);

To make objects move I have 2 approaches

Approach 1

  1. Create a MonoBehaviour Script (with my motion functions)

  2. Attach the Script to all Moving Objects That I want to move,

  3. ON_FINGER_UP, Send message to Object to start moving ClickedObject.SendMessage("moveStart",V2coordinates, SendMessageOptions.DontRequireReceiver)

  4. update() will wait for moveStart Flag , and once moveStart Flag received, then

  5. update() I keep moving my object.

  6. Once Object reached destination, moveStart Flag is set false,

Approach 2

  1. Create a MotionManager Empty Game Object

  2. Attach MotionManager Script (with my motion functions)

  3. ON_FINGER_UP, GetComponent< MotionManager >() and call a function void MoveObject(GameObject Object2Move, List MotionPath, float speed)

  4. Function MoveObject can move the objects using 2 approached

a. Start a new Co-routine ( StartCoroutine())

b. Use the update() function and move the object ( this option seems no good, as this will be moving objects one by one and I have 15+ objects moving, so first object will have to wait for all objects to move )

I need your advice what approach should I adopt for a better performance in terms of mobile resources utilization,

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

0 Replies

· Add your reply
  • Sort: 

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

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

Multi-core PCs and performance. 0 Answers

Multiple small update calls vs one large update call? 1 Answer

Performance Issue with Coroutines 2 Answers

Unity performance questions 1 Answer

gfx.WaitForPresent causing performance drops? 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