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 NERDpoke · Oct 29, 2017 at 09:48 PM · physicsrenderingoptimizationprofiler

Physics and Rendering Optimization Issues

So the past two weeks I've been working on a rather simple game. The whole game is pretty much directing a a cube with the camera attached through a bunch of obstacles (Imagine a star fox endless runner). The game is now for the most part finished except for the few optimization problems I've been having. alt text

That is a screenshot I took while profiling my game and as far as I can tell both rendering and physics are using up a ridiculous amount of the cpu. I have absolutely no idea why this is, the only thing I'm really doing with physics is setting the cube's x and y velocity based on the Horizontal and Vertical axes as well as increasing the velocity on the z axis by 10 * Time.deltatime each frame so that you speed up and it gets harder to avoid the obstacles. As for rendering the only taxing thing I can think of would be that I'm using a post processing profile with occlusion turned on but nothing else. Below is the code that controls the cubes velocity, it is the only script in my project that does anything with physics so i assume this is where the problem is coming from.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class ShipController : MonoBehaviour 
 {
     [SerializeField] private Rigidbody rb;
     private float speed = 1000;
     private Vector3 SetVelocity;
     private float forwardVelocity = 1;
 
     private void Update () 
     {
         //Controls acceleration and speed limit.
         speed += 10 * Time.deltaTime;
         speed = Mathf.Clamp(speed, 0, 2700);
 
         //Sets velocity based on input from the x and y axis as well as the  forwardVelocity value.
         SetVelocity = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), forwardVelocity);
         SetVelocity *= speed;
     }
     private void FixedUpdate()
     {
         rb.velocity = SetVelocity * Time.deltaTime;
     }
 }

Originally I was setting the velocity inside of Update itself but I decided to change it because I'd heard somewhere that FixedUpdate was more tailored towards physics, however doing this didn't help at all. I have absolutely no Idea why this is happening so any help would be appreciated and also if you have any idea why rendering might be using up so much of the cpu that would also be appreciated! P.s. for the games visuals I'm only using the base unity cubes except at different scales and rotations and there is only ever a max of 10 of them in the scene at once.

profiler.png (204.1 kB)
profiler.png (204.1 kB)
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

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

Draw Calls are still HIGH? 0 Answers

,DoRenderLoop_Internal() - How would you optimize this for Android and Iphone? 0 Answers

Looking For Tips On Optimizing Camera Rendering To Increase Framerate 1 Answer

Camera still rendering everything even when using occlusion culling 1 Answer

profiler showing vsync is main cause for performance issues. while vsync is of in quality settings. 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