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 VLEX26 · Nov 07, 2013 at 06:44 AM · performancescalingmusic

Non-uniform Scaling Performance Issues. Need advice.

Hello,

First time asking a question here, so ill try explain my situation as best I can:

I'm making a side-scrolling music game using a C# FModEx library. All music data related functions are ran on separate threads (just in case that information is relevant). Here is a short video demonstrating what im making [[YouTube Link]][3]

In the main scene, I have 1000 cube primitives spanning from one side of the screen to the other created at runtime (see images below). When the song starts, the cubes are given floats to scale the y axis to. One block represents one millisecond. Here is the code for the scaling:

     private static void Dynamic()
     {
         for(int i = 0; i < Blocks.Length; i++)
         {
             Scale.y = (Analyzer.ScanDb[Analyzer.CurrentPosition + i] * 250.0f);
             Blocks[i].transform.localScale = Scale;
         }
     }

Right now im running at about 50-70 fps. So my main question is: Is there any way to make the scaling process less intensive or just a better process all together?

Thanks in advance and i hope ive supplied enough information :) alt text

alt text

[3]: http://www.youtube.com/watch?v=YMk-rOeY-Sk

playing.png (23.9 kB)
idle.png (14.7 kB)
Comment
Add comment · Show 6
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 Huacanacha · Nov 07, 2013 at 06:49 AM 0
Share

Are you using a prefab for your cubes?

avatar image VLEX26 · Nov 07, 2013 at 11:49 PM 0
Share

No. using GameObject.CreatePrimitive(PrimitiveType.Cube).

avatar image VLEX26 · Nov 08, 2013 at 12:10 AM 0
Share

Ill give that a try now and report back.

avatar image rutter · Nov 08, 2013 at 12:18 AM 0
Share

Is the performance problem caused as you're scaling, or is it an ongoing problem when rendering? Could you try generating procedural geometry ins$$anonymous$$d of scaling cubes? As a slightly more lightweight alternative, what about keeping object pools of cuboids at various sizes and using those?

avatar image VLEX26 · Nov 08, 2013 at 12:41 AM 0
Share

$$anonymous$$aking the cubes prefabs worked! Unity is now batching the draw calls :)

Show more comments

1 Reply

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

Answer by Huacanacha · Nov 07, 2013 at 11:55 PM

I'm not sure how primitives are handled by Unity, but prefabs are designed to be as efficient as possible for memory and rendering performance. Check out the number of draw calls your code is currently generating (via the profiler on the game panel), then switch the cube to a prefab and check again... it will probably reduce drastically. If the prefabbed cubes all use the same material etc they should only need one draw call to render them all.

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

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

17 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

Related Questions

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

WorldToScreenPoint in Update/OnGUI: Bad Performance 1 Answer

Best Practice For Shader Complexity + IOS 1 Answer

Total memory allocated increases indefinately from .80GB untill crash 3 Answers

Performance when having Update functions in many gameObjects ? 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