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 /
This question was closed Jun 09, 2016 at 07:02 PM by willoliveira for the following reason:

A questão foi respondida e dada como aceite

avatar image
0
Question by willoliveira · Jun 09, 2016 at 12:02 PM · scalespriterendererscaling

Scaling GameObjects by Screen Resolution

I have a container with many SpritesRenderer. I need scale this container by Screen Resolution. I've tried many things and do not know how do = /

I cant keep the screen size LocalScale or slightly less (I would leave him with an edge on the screen as the picture below).

alt text

If I could pick up the container size and calculate its size related to the size of the screen, it would be the ideal for me because I need always resize this container in various situations and different screens.

OBS: I cant use UI, because i need manipulate with drag and drop theses sprites, so i need of Box Collider, what not work on UI, between other things... I managed to make this resize the UI, but as I mentioned, that way does not help me.

img.png (11.7 kB)
Comment
Add comment · Show 5
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 EpiFouloux · Jun 09, 2016 at 12:09 PM 0
Share

I don't see why UI can't work.. but you can access the screen size and other informatins here: https://docs.unity3d.com/ScriptReference/Screen.html

avatar image Munchy2007 · Jun 09, 2016 at 01:01 PM 1
Share

There's absolutely no reason why you can't use the UI for drag and drop, two of my recently released games use nothing but UI elements for the display graphics and they are both touch and drag type games. Also the drag and drop inventory system for the RPG game I'm currently working on is implemented using the Unity UI components.

I'd suggest you look into using the UI for your problem as it will be the easiest way to keep things scaled with the screen size, and if you need help getting it working make a thread in the forum and ask for help.

avatar image willoliveira Munchy2007 · Jun 09, 2016 at 01:19 PM 0
Share

Understood. I did resizing UI, I'll try to change my drag to the UI. thank you! One more thing, I can tell if Drop upon some element, as BoxCollider?

avatar image willoliveira Munchy2007 · Jun 09, 2016 at 03:02 PM 0
Share

I did it Drop areas, really thanks you for the statement!

avatar image Mmmpies · Jun 09, 2016 at 03:39 PM 1
Share

If using the UI then put the anchors to the corners of each element and it should scale with the screen resolution. Different aspect ratios may well look stretched or squashed though.

You could always do a rough calculation of the aspect ratio from screenHeight and screenWidth and then have a few differing Canvases so one for 4:3 one for 16:9 one for 16:10 there are only a few aspect ratio's as opposed to resolutions so it's extra work but not too much.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Imported Scale Animation Ignored in Viewport 0 Answers

Sprite renderer scaling 0 Answers

How to scale an object clone to fit a cube 2 Answers

Ui elements not scaling correctly 0 Answers

Particle System Scaling - Not working for velocities 2 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