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 Kazaskater · Jan 04, 2011 at 03:02 AM · gamegraphicsspeedquality

How can I speed up my game?

I am making a FPS, and the map isn't very big. Its about the same size as the unity demo. I have a main script that kinda takes care of stuff like the weapons, flashlight, scope, etc. Could the script possible be slowing down the game? It has like 20 variables and is about 700 lines of code. I have even tried disabling the script to see what would happen, but it didn't make much of a difference, so I don't think its the script. I have tried getting rid of as much trees and stuff as possible, but still, nothing. Any ideas?

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

Answer by d3coy · Jan 04, 2011 at 03:45 AM

Could be any number of things. Since the free version of Unity doesn't come with a profiler, it's hard to know. That's a big reason you should pay attention to your framerate after each and every change/addition you make to your game. Otherwise, you end up in a situation where you've no idea what the problem is.

Some big culprits are usually things like doing too many things every Update, too many physical objects, scene complexity... all obvious stuff. My advice to you would be to do what you've been doing -- removing possible performance degraders and assessing your performance after each removal.

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
1

Answer by _Petroz · Jan 04, 2011 at 05:40 AM

This is based on the assumption that your application is CPU bound, there are many possible factors which can cause a game to run slowly.

The number of lines of code and number of variables is inconsequential. It is often a small section of code which slows things down. This is a good place to apply the '80:20' rule (80% of the time is spent executing 20% of the code). Without a profiler it's difficult to locate which areas of the code are slowest. The easiest method is to remove code and see what difference it makes to the performance.

The easiest way to prevent code from executing would be to rename 'Update' to something else such as 'Update_disabled'. Do this for one class, and run your game and measure the difference. Do that one by one for each class until you find that slow code. If you see a big performance boost after renaming one function, then you have found the problem. Next you can use block comments or preprocessor directives to remove chunks of that function and narrow down the search further.

Once you find the code, optimize it. Generally algorithmic optimizations are better, although code tuning can prove useful in tight loops.

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 Kazaskater · Jan 04, 2011 at 10:01 PM 0
Share

Thanks for the response. I just removed the entire script to see what would happen, and still, nothing. It still goes pretty slow. I have a pretty fast computer too. I have a mac with a dual core 2.53 ghz processor, and 4 gigs of ram, so it shouldnt be that slow.

avatar image _Petroz · Jan 04, 2011 at 11:07 PM 0
Share

It's probably not the code that is the problem them. How many polygons do your meshes have and how many meshes are there?

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

No one has followed this question yet.

Related Questions

Android build not displaying correctly? (answered) 1 Answer

Is it possible to make a game look good without third-party programs? 1 Answer

hollow objects, hollow mesh? 1 Answer

PlayerPrefs Bug 0 Answers

Achieving Good Graphics in Mobile 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