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 ballgame570 · Nov 26, 2017 at 07:59 PM · pathfindinglevel-designmap making

Creating a grid for sceneview and in game,Making a simple grid map editor for Sceneview

I want to create a grid of tiles that are capable of storing and relaying info for pathfinding. Ie. This is a wall and therefore not walkable, or spawn an object on this tile for it to be picked up by a character later, or direct a character to walk to this tile, etc. I want it to be grid-based so that movements are fixed to the tiles.

Now I have a general idea of how to do most of this. But I don't know how to create one in scene view, as I want to be able to manually place objects, wall, and characters on it, the game doesn't need to have procedurally generated levels. And having to design a level with code alone is just tedious.

I know gizmos can be used to create a grid in scene, but can I rely on it to be the basis of what I'm trying to do in game? If not, what method should I use?,I'm new to Unity and coding in general, but I know how to use loops, functions, pointers, array, etc. I just don't have enough experience to figure out the programming logic just yet. So I'm looking for advice that points me to the right direction so I can do some more research.

I want to make a simple 2d tile based movement/ pathfinding system for my game. I know how to use loops to instantiate a grid of tiles made up of different types, but I can't use it as a map editor since it only runs when the game is running. I want to be able to manually hand place objects and walls in the sceneview, with a grid underneath so I can make sure placement of objects are precise.

So another option is to use Gizmos to draw a grid. But my question is if I use Gizmos, can I rely on it to be able to store data for me while the game is running? For example, if I want my game to be able to detect and relay which tile a character is on right now for pathfinding reasons, or which tile is a wall and therefore not walkable, or a chair is on this tile so walk to this tile to seat, or spawn an object on this tile for someone to pick it up later, etc.

Or am I thinking the complete wrong way? Is there an easier method to build my level?

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
0

Answer by rvilgalys · Nov 26, 2017 at 08:33 PM

I think you'd want make a 2d array of your tile data for the easiest lookup, possibly in a ScriptableObject. Gizmos are really just for drawing things in the scene view, not as much a good place for data handling. A small editor script attached to your prefab tiles could talk to the 2d array to Add/Remove with OnEnable() and OnDisable().

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 ballgame570 · Nov 26, 2017 at 11:36 PM 0
Share

Thanks for the suggestion, but I think I found a simpler solution. I can keep all the code for the tiles generation, and just use the same logic to display an identical gizmo to see where the levels will be for the scene view. Don't know why I didn't think of that earlier...

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

74 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

Related Questions

What is the best way to make Half - Life or DOOM style levels? 2 Answers

ftl-like map generator 1 Answer

Will ever Unity have Pathfinding and cut-scene editor? 1 Answer

Pathfinding tools in Unity? 9 Answers

How to Implementing Morten Nobel-Jorgensen's A* Pathfinding 3 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