Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Lethn · Jul 12, 2015 at 11:51 PM · gridbuildingplacementbuildings

Up to date Unity building placement code/tutorials?

Hey guys, I'm searching around but does anyone anyone know where I can find up to date code or tutorials on building placement ( the kind you have in RTS' and city builders )? If it also included details on how to snap building to a grid that would be great.

I've found lots of old tutorials but a lot of these date back to 2012 and the people who made them never bothered updating their code. It would be great if you could point me towards an example code or tutorial that actually works with the current version.

Comment
Add comment · Show 4
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 Cherno · Jul 13, 2015 at 08:22 AM 0
Share

Why wouldn't the old tutorials notwork with the new Unity versions anymore? It's still C# so snapping GameObjects to a grid is as simple as before. What have you tried so far yourself? Hint: You would need Physics.Raycast to get the cursor position, and $$anonymous$$athf.RoundToInt to snap the selected building to the grid.

avatar image Lethn · Jul 13, 2015 at 10:10 AM 0
Share

lol Well I'm just re$$anonymous$$ded of the struggle I had with following an out of date platformer tutorial and finding it much easier when looking at 2015 stuff. The problem is when I say these tutorials are old, I mean really old like 2009 and so on so if there were an up to date tutorial it would just save a lot of fussing around.

I get what you're saying, I guess I'll have to poke around again, either that or I just need a better understanding of the code which is more likely.

avatar image dolmaci · Jan 09, 2016 at 12:02 AM 0
Share

Can you share these tutorials' links please?

avatar image Lethn · Jan 09, 2016 at 03:54 PM 0
Share

I made a thread on Unity detailing some of the fixes I found and so on for any problems you might encounter making RTS' plus links to a bunch of tutorials.

http://forum.unity3d.com/threads/best-way-to-implement-rts-style-building-placement.373867/

Hope it helps, the biggest problem I had was not understanding Pivot points/centres ( whatever you want to call them ) which drastically affects how your code interacts with GameObjects in the Unity Engine.

After understanding exactly how all that work all the code worked fine, this should prevent a lot of headaches when people are looking up stuff for RTS' and don't understand why their code isn't working right even though there are no errors popping up.

1 Reply

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

Answer by Lethn · Jul 13, 2015 at 01:37 PM

loooool!

My bad, completely my bad, what had happened was that I had written out this code and tried following a tutorial during a heatwave. So my brain was so screwed that I wasn't concentrating on what I was doing, just by going through it again I have fixed several errors.

Why is it you sometimes only solve a problem after you've written down a question? Anyway, I'm down to one error now but it will be an easy fix.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Minecraft like building? 2 Answers

How to make a grid and able to place buildings on? 0 Answers

Add game building items to dropdown list? 1 Answer

unity - place objects by format 1 Answer

Grid system visualization 1 Answer


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