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 petr_pes · Jan 18, 2017 at 08:58 PM · 3dshadersscaling

3D object scaling causes game to work slow

Hi everyone! I know that this issue have been discussed many times, but still I can not solve it. There are a lot of simple 3D objects (cylinders) on my screen and in the sceene (about 30 at the time). All of them have "Mobile/Diffuse" shader, but at the same time I need to scale each one of them, which, as I suppose, causes FPS yo be higher than recomended value. Especially on android devices. Any advices how to optimize the scene?

Comment
Add comment · Show 1
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 AurimasBlazulionis · Jan 18, 2017 at 09:14 PM 0
Share

Give more information. Screenshots of profiler or something.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by petr_pes · Jan 20, 2017 at 05:40 PM

alt text As you can see on the picture above, there are a lot of red lines spawned which are all in fact 3d cylinders with "mobile/diffuse" material attached. I'ts important to mention that there is a spawner component in a program working perfectly, so all the objects you see on the screen are only objects enabled and active and rendering in a present moment.

alt text On the picture above you can see one cylinder's object inspector. As you can see it does not have collider.

Script on update of each cylinder is a little bit tricky:

void Update () {
    if (!(gameObject1PositionBefore.Equals(gameObject1.position) &&
        gameObject2PositionBefore.Equals(gameObject2.position)))
    {
        selfTransform.position = (gameObject1.position + gameObject2.position) * 0.5f;
        selfTransform.localScale = new Vector3(startScale.x, (gameObject1.position - gameObject2.position).magnitude / width, startScale.z);
        selfTransform.LookAt(gameObject1);
        selfTransform.Rotate(new Vector3(90,0,0));
        gameObject1PositionBefore = gameObject1.position;
        gameObject2PositionBefore = gameObject2.position;
        if (!isRendered)
        {
            SetVisible(true);
        }
    } 
}

here it's imporatant to mention that gameObject1 and gameObject2 are just the dull objects which stands at the both ends of the stick determing it's position and scale


img1.png (45.9 kB)
img3.png (42.1 kB)
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

95 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

Related Questions

Add Color Overlay to 2D Unlit Images 1 Answer

How do I change the scale over a time for a shader? 1 Answer

How can I use the Skybox/Panoramic shader so that it displays inside a sphere? 0 Answers

How can I add a shader to an entire environment? 0 Answers

How do I cell shade terrain? 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