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 romaroma86 · Nov 10, 2013 at 07:36 PM · positionscalesizespaceoffset

Permanent space between objects

I try place 10 cubes side by side with space like on image

alt text

but i have problem – some time space between objects looks different.

My code for x cube position

 float lastX = startPoint;
 float offsetBetweanCubes = 0.3f;
 
 for(int i=0; i < 10; i++) {
 lastX += gameObj.GetComponent<MeshFilter>().mesh.bounds.size.x + offsetBetweanCubes;
 Instantiate(gameObj, new Vector3(lastX, lastY, startPoint.z),  Quaternion.identity)
 }

is it way to fix this?

gamescene.unity - japanese nonograms unity - iphone, ipod touch and ipad 2013-11-10 23-14-55.png (1.9 kB)
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

2 Replies

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

Answer by Dracorat · Nov 12, 2013 at 04:43 PM

The spacing is the same - what you're seeing is the result of being zoomed out and having geometry not perfectly aligned to pixel edges.

You need to adjust the zoom of your camera to get the spaces to all appear the same. Also, if you maintain the same zoom at different resolutions, each resolution will appear different. If you can fix it for one resolution, then you need to maintain the same pixel ratio for geometry in other resolutions - by increasing or decreasing how much is on-screen (instead of scaling the scene according to resolution)

Comment
Add comment · Show 1 · 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 romaroma86 · Nov 18, 2013 at 07:06 PM 0
Share

You are right. When i fix screen aspect to 4:3 or 3:2 grid displayed right. Thank you.

avatar image
0

Answer by Triqy · Nov 10, 2013 at 07:46 PM

 using UnityEngine;
 using System.Collections;
 
 public class example : MonoBehaviour {
     public Transform prefab;
     void Example() {
         int i = 0;
         while (i < 10) {
             Instantiate(prefab, new Vector3(i * 2.0F, 0, 0), Quaternion.identity) as Transform;
             i++;
         }
     }
 }
Comment
Add comment · Show 1 · 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 romaroma86 · Nov 11, 2013 at 06:31 PM 0
Share

Thank you. I try this but have error on this line:

 Instantiate(gameObj, new Vector3(i * 4.5F, 0, 0), Quaternion.identity) as Transform;

Only assignment, call, increment, decrement, and new object expressions can be used as a statement

if i delete "as Transform" compilation success. But problem not solved.

alt text

space between objects still different.

Note: i use camera with orthographic projection.

gamescene.unity - japanese nonograms unity - iphone, ipod touch and ipad 2013-11-11 22-28-39.png (2.3 kB)

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

18 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

Related Questions

Set Colliders at same size 2 Answers

Positioning gameobjects by a corner, not by center 0 Answers

Scaling Planets based on Distance from Camera 1 Answer

How to rotate/scale a prefab instance from the GUI? 2 Answers

How do I permanently resize a model with children? 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