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
1
Question by Sarthak123 · Oct 25, 2014 at 05:46 AM · optimizationoptimizetips

Unity Optimization Tips !

Hi Everyone, I am stuck on thinking which thing causes a lag in unity and how to optimize it.. i need help on the following topics !

  1. Does The Length Of The Script Makes A Game Slower?

  2. Which is better, a table made inside unity from 5 cubes or a table imported from a 3d modelling software carved out from a single cube?

  3. Does the function Update reduces the optimization of the game? In other words does an empty function update in every script reduces the speed of game, even by 0.001%?

  4. can co-routines be used as an alternative to Function Update?

  5. Which is better Co-routine, update or fixed update?

  6. I have a script in my game which generates about 100 low-poly trees, 100 low-ply rocks and 1000 traps(considering each trap having 4 blocks), and all these have a script attached to them, so in other words about 1200 scripts are working, is this ok?

  7. Does making an object child reduces lag?

  8. Which type of texture to use, low quality or high quality?

  9. And finally, which sounds are to be compressed more, large sounds(like background musics, etc.) or short sounds(like spells, button click, etc,)?

  10. How can i view the size occupied by each of the item in total? like texture occupies 100MB, sound occupies 80 mb, etc.

Thanks

EDIT : one maint thing i forgot to ask, which scripting language is optimizing wise best? Java, C++, or boo?

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

1 Reply

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

Answer by AlwaysSunny · Oct 25, 2014 at 06:40 AM

  1. Script length doesn't matter. Maybe a teeny, tiny bit, but that's really splitting hairs. That said, script length does affect compile time. At runtime, it's all about what each line does.

  2. Sounds like you're not yet familiar with draw calls, batching, and other optimization-specific aspects of the render pipeline. Bottom line, fewer objects is better, even if your group of objects has the same number of verts/tris as your single object. See the docs for more on this.

  3. Having an empty Update(){} does affect performance. Probably by 0.001%, but yes. Empty functions are executed, which takes a measurable amount of time.

  4. Co-Routines are a very powerful feature. A common usage for them is executing code every N seconds instead of every frame, which can offer huge optimizations depending on what's being done.

  5. No such thing as "better" - Update is for things that must happen every frame. FixedUpdate is for things which interact with physics (it has other uses too). Co-Routines are not simply alternatives to Update/FixedUpdate/LateUpdate, but are tools you can use to build smarter, cleaner, and more efficient algorithms.

  6. Having this many objects or scripts isn't "bad". It also doesn't sound super good. When working on projects with tons of objects and scripts, it's important to consider exactly how much work is being done, and whether you can reduce that workload. (Protip: The answer is almost always "yes" for a long, long time... Until it's not.)

  7. Parent/Child relationships have almost no bearing on performance.

  8. Import the highest quality textures you have. Their import settings and the project quality settings help determine whether high or low res versions are used.

  9. All I really know about this is compression is good, until it's not. Meaning, compress as heavily as you choose while ensuring the sound quality is acceptable.

  10. If you have Unity Pro, you have access to the Profiler, which gives detailed info about memory usage, performance, and many other things.

Just because I never turn down an opportunity to steer new programmers away from unityscript and boo, I'll strongly recommend C#. Very, very strongly. You'll thank me some day if you do. Or say "Man, that guy was right..." someday if you don't.

Good Luck moving forward and learning more about Unity,

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 Sarthak123 · Oct 25, 2014 at 07:35 AM 0
Share

Thanks ! It helped me a lot, yes i am still unfamiliar with many of the aspects of unity and game developing..thanks for helping...

and i know java much better than c# so should i go with java still? or turn my way to c#?

avatar image AlwaysSunny · Oct 25, 2014 at 08:00 AM 0
Share

You're welcome! Glad to help. Please consider marking my answer as correct if you can.

C# is superior to UnityScript (aka Javascript) and Boo in too many ways to bother listing. It is strongly preferred by experienced programmers for these reasons. It offers features which are cumbersome (or just plain missing) in the other two languages. Furthermore, 100% of your C# skills will transition to non-Unity environments - the same isn't true of the other two.

Don't worry about making the switch during this project - you should stick with one language per project or headaches will happen. But next time around, try C#. It's not very hard to make the change, and the benefits are 110% worth it.

avatar image Sarthak123 · Oct 25, 2014 at 08:39 AM 0
Share

oh thanks, yes i have accepted your answer as correct as it helped me a lot..

avatar image psykojello2 · Jun 02, 2015 at 04:19 AM 0
Share

Late answer to this question, but for #9, I have read that it's better to use compressed audio for longer audio such as background music and uncompressed audio for short/quick clicks and spells type SFX.

Great question as well as answer!

avatar image Sarthak123 · Jun 02, 2015 at 05:22 AM 0
Share

thank you for the tip ;) no worries about being late

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

28 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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

What's the best way to optimize draw calls with 100,000+ bjects? 1 Answer

how to move between scenes 1 Answer

Preloading / Caching Prefabs [Unity iPhone] 4 Answers

Uncombine Children? 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