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 SpiderJones · Jan 08, 2016 at 05:14 PM · endless runnermobileoptimizationstatic batching

Optimizing endless runner - move camera and player, or move everything else?

Optimizing endless runner

I'm taking a Unity game that wasn't made with mobile in mind and optimizing it for tablets. Currently the player and camera don't move while everything else does. It's not really a runner, but it's close enough. So my question is, is it better to have everything static and take advantage of static batching, and have the player and camera move (with some compensation to avoid float overflow)? Or should the player and camera not move and everything else move?

Any suggestions?

Thanks!

Comment
Add comment · Show 4
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 callen · Jan 08, 2016 at 06:55 PM 0
Share

It's a pretty subjective question and depends a lot on how you implemented everything, but I'd say in general less moving objects is good. And since you can only do the static batching on non-moving stuff I'm guessing there's more to gain from batching the level than the player

avatar image SpiderJones · Jan 11, 2016 at 06:31 AM 0
Share

Thanks everyone. I've already added Object Pooling. What about batch lighting on static objects? Will that still work if I have to "recycle" objects?

avatar image SpiderJones · Jan 11, 2016 at 03:28 PM 0
Share

If the player isn't moving, or if the player is moving, I still need to add terrain in front of the player.

If the player/camera is moving, and I take the terrain objects that are behind the camera and place them randomly in front, and the lighting is directional (outside), can I still batch the lighting? The terrain objects are mostly static, but do need to be moved in a loop.

avatar image SpiderJones · Jan 12, 2016 at 09:24 AM 0
Share

If the player isn't moving, or if the player is moving, I still need to add terrain in front of the player.

If the player/camera is moving, and I take the terrain objects that are behind the camera and place them randomly in front, and the lighting is directional (outside), can I still batch the lighting? The terrain objects are mostly static, but do need to be moved in a loop.

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by xixao3d · Jan 10, 2016 at 07:16 AM

Moving objects around the player is better in this situation, as there is a loss in precision when dealing with large distances from the zero world origin (0, 0, 0). Unless you plan on somehow resetting the player and camera position back to start without the player noticing, it's better to move the objects instead.

I am working on an endless runner right now, and have an object pool script that shares pooling with 3 spawn points. The objects that are spawned receive velocity on Start(), and watch their position relative to the main camera's view. When they leave the visible area, they deactivate themselves and return to the pool. The player and camera are always docked to their origin, so there is never a need to reset their positions or worry about precision loss.

Comment
Add comment · 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
0

Answer by slake_it · Jan 10, 2016 at 10:51 AM

i think for a simple game, having a simple structure is more important than very very small optimization (if you check the profiler, you notice that rendering consumes most of the time), so i recommend moving the camera & the player.

  • pooling is a must on mobile, check out this library for the most flexible pool i've ever used

  • https://github.com/UnityPatterns/ObjectPool

Comment
Add comment · 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
0

Answer by idurvesh · Jan 10, 2016 at 12:23 PM

Move camera with player....that has more advantage than moving ground itself...

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 SpiderJones · Jan 11, 2016 at 04:38 AM 0
Share

If the player isn't moving, or if the player is moving, I still need to add terrain in front of the player.

If the player/camera is moving, and I take the terrain objects that are behind the camera and place them randomly in front, and the lighting is directional (outside), can I still batch the lighting? The terrain objects are mostly static, but do need to be moved in a loop.

avatar image idurvesh SpiderJones · Jan 11, 2016 at 06:10 AM 0
Share

Yes I will suggest to pre bake lightmaps onto those terrain then do what you planned to do

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

8 People are following this question.

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

Related Questions

Convert png or psd to PVRTC? 1 Answer

How to reduce draw calls for efficient 3D model rendering 1 Answer

Problem with Android Framerate in Unity 5 0 Answers

Maximum Fixed Timestep Allowed on an iPhone/Android 0 Answers

How would I make an object rotate where the joystick is facing. 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