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 TommyCarrella · Jun 24, 2014 at 05:42 PM · camerazoomtower

Problem with Orthographic Camera

I'm working on a Tower Defense Game in Unity and I have the main camera set to Orthographic. I've also set up a zoom in function to allow the player to zoom in and out using the scroll wheel. Here's the code:

 if (Input.GetAxis("Mouse ScrollWheel")) {
     CameraZoom -= Input.GetAxis("Mouse ScrollWheel") * ScrollSpeed;
     CameraZoom = Mathf.Clamp(CameraZoom, 0, 15);
 }
 
 Camera.main.orthographicSize = Mathf.Lerp(Camera.main.orthographicSize, CameraZoom, 0.25);

It works great, the only problem is for some reason as the size of the camera gets larger the game its slower and slower. As I zoom out in game the Draw Calls, Tris, and Verts dramatically increase. At a scale of about 15 my drawcalls become about 12,000. At a scale of 0 they are 0 and everything in between.

Why is this? There are at most 40 game objects in the scene at once, most of them static with no rigidbodies. Can anyone help?

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 IvovdMarel · Jun 24, 2014 at 05:48 PM 0
Share

How many polygons do these objects have? Is your game 2D or 3D - note that ortographic cameras are for 2D & UI only. 40 2D gameobjects could never cause 12k drawcalls

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Wiki

Answer by TommyCarrella · Jun 27, 2014 at 06:08 AM

It's 3D using the orthographic camera at a rotation of 45 degrees on the x and y axis so that that I can see my game in a view similar to a typical isometric scene. Like this :

http://fc04.deviantart.net/fs71/f/2011/221/0/3/isometric_earth___n___grass_tile_by_redknight91-d45ygpb.png

But anyways, I figured out the problem I had a written a few lines of code to create a small landscape and didn't realize it instantiated it hundreds of times so it was generating FAR MORE objects than I thought but they were all stacked on each other and I didn't realize. All fixed now lol

So I guess if anyone else runs into this problem it's because you just have too many objects in your scene, nothing to do with the scaling.

Thanks for helping anyways IvovdMarel :)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Changing camera position to shoot through scope on gun 1 Answer

Lining up Fov's 0 Answers

How to do perspective camera zoom? 1 Answer

Camera zooming in and out 1 Answer

Zooming in and out with an orthographic camera, while the bottom edge is fixed. 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