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 /
avatar image
0
Question by Truvia · Sep 03, 2017 at 10:26 AM · positioncanvasgridmappositioning

Creating a Procedural Grid positioning problems

I've been following along a couple of tutorials about mapping grids (for hex tilemapping etc), in particular link:here. I'm just exploring different ways of doing the same thing but have run into a positioning problem early on.

The way this tutorial works is this:

  1. have a parent "HexGrid" object with a script which instantiates a bunch of planes in a 6x6 grid, as child objects; and

  2. Have a Canvas which is child to the HexGrid object. The HexGrid script also instantiates a bunch of text labels in exactly the same position as the planes, to tell you the coords of each plane. These text labels are childed to the canvas

However, I'm getting a problem which I've seen time and time again and I'm wondering if there's something wrong with my Unity. Although the childed Canvas has position 0,0,0 and pivot 0.5 etc, the canvas doesn't actually sit in the right place and I have to offset it by 1.5 in x and -3 in z in order to get the labels to sit in the right place. You can see what I mean in the screenshot, where the labels don't align. The coords of the labels are precisely the same as the coords of the planes.

I found the same thing when procedurally generating a grid, using their earlier tutorial link:here. The grid was instantiated starting at 0,0,0 but in real terms it is actually out of place in scene and game view by 0.5, 0, 0.5. Its easy to fix through a hack (by just setting the parent object at 0.5, 0, 0.5) but that means that you have to add in an extra 0.5 into your code for positioning other objects that are not childed.

Can someone check (just up to the end of step 2.2 in the hex tutorial) to see if it is just me? Is there anything anyone can think of that might create this maddening problem? I assumed it was something to do with the Canvas positioning, but maybe there is a setting I don't know about?

Thanks for the help!

alt text

alt text

2017-09-03-2.png (371.3 kB)
2017-09-03-1.png (370.5 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

0 Replies

· Add your reply
  • Sort: 

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

81 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

Related Questions

Player position with script and screen sizes 0 Answers

How to place an object near N number of objects in order to avoid overlap? 0 Answers

Move object with Translate on X axis (with mouse) 0 Answers

Offset position to a target 3 Answers

How to name each grid cell in a grid... 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