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 haroonalam · Sep 28, 2011 at 03:31 PM · c#grid

What is grid in unity and how can I implement it ?

Hey guys, Em a begineer.. I need to place a grid on my map in unity and would like to access it to place a simple object on mouse click. How can I acheive this ?

I am unable to understand the grid functionality, should I have to write a 2d array code or is there something in unity that I can access, and what is basically the grid like something when I click my background image ?

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

1 Reply

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

Answer by BerggreenDK · Sep 28, 2011 at 09:11 PM

Unity makes a "free vector world". So you decide what resolution your grid should be.

Lets say your grid is 1x1 unit, then you could add a Default Plane, rotate it 90 degress and assign a texture with a "grid" onto it. As I recall this object needs to be scaled to match the units in Unity, but play around and see what fits your needs.

Regarding the click on it. There are several options, but none is "free". You'll need to do the scripts for it. Its not standard in that sense.

You can go for a Raycast/collider method or you could use WorldToScene coords and many other tricks. You can basically do everything, as long as you are willing to write the scripts for it.

Comment
Add comment · Show 3 · 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 haroonalam · Sep 29, 2011 at 08:05 AM 0
Share

ok thnx for the reply. As I am going to place towers on my plane so what my understanding up to now is to make 2D Array first on my plane and access it to place towers. right ? for e.g place tower on myArray[0,0] OR I should access plane position without making 2D array ? for eg. place tower on transform.position(x,y,z). The game I am going to make is like http://fieldrunners.com/media/

avatar image BerggreenDK · Sep 29, 2011 at 10:46 AM 0
Share

For a gamle type like Tower Defence a grid could be an option. But if you place the "tower spawn points" as other objects/triggers then that could also do the job alone. Its more up to you how you want to build your algoritms. You also have to think about the "path" for the enemies. Is that vector waypoints or do they have to follow your grid tile for tile.

avatar image haroonalam · Sep 29, 2011 at 01:56 PM 0
Share

I am not going to follow any desired path. Enemy will move forward where there is no collision

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

Distribute terrain in zones 3 Answers

Multiple Cars not working 1 Answer

A node in a childnode? 1 Answer

How can I make grid tiles/plane transparent 1 Answer

RTS Grid Initialisation 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