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 seandolan · May 15, 2018 at 05:12 PM · 3dtilesfloor

What is the correct way to create individual floor tiles in a 3d game?

I am creating a game that allows players to draw individual rooms on a 100x100 grid. The grid is visible when they draw their rooms as well as during the game play. The rooms can be irregular shapes but each 1x1 grid tile can not be divided. 1 tile, 1 space and any number of tiles to make up the room.

Example of the game view

I am running a function afterwards to automatically place walls between different rooms. I am currently running through the following command to draw each cube. The result is 10,000 cubes though. If I hide the entire set of cubes my fps is over 70. If I make them visible it's more like 40 odd.

 for(int i = 0; i < floorTiles.Count; i++) {
             GameObject newTile = Instantiate(blankTile,new Vector3(floorTiles[i].x,0,floorTiles[i].y),transform.rotation,floor.transform);
         }

The Instantiate part isn't running slow at all - it's quite quick. But the visual rendering of so many cubes seems to weigh Unity down too much. I am sure that I am just missing the concept somewhere of how to make this work and my best efforts of trying to find the answer online lead me more towards 2d projects.

So my question is what is the correct way to create individual floor tiles in a 3d game.

floortiles.jpg (373.8 kB)
Comment
Add comment · Show 1
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 seandolan · May 15, 2018 at 05:57 PM 0
Share

Have changed the cubes to quads with no texture just to test and it still drops right down in fps. It looks like (from someone on discord) that there should be no problem with this. Other complex games are running fine.

1 Reply

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

Answer by Captain_Pineapple · May 16, 2018 at 08:31 AM

Well first up you could use the builtin Unity Profiler to determin what actually takes up all the processing time. Sometimes the results can be surprising.

Secondly to solve your problem you might want to think of something like the following:

Change your 10000 floor Objects into one large Object with one Collider and a texture that simulates a grid. When you do a raycastings (which i assume you do) to determine the targeted tile you can simply calculate the rounded position of the hit-point of your raycast. There you can either:

  1. Use a Projector to project a given tile graphic/texture on the current position.

  2. Or Instantiate a quad like mentioned by @seandolan with the tile-texture applied.

I hope this helps, if you have more questions regarding this feel free to ask.

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

96 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 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

Translate a 2D position to a 3D space 1 Answer

3D Terrain Tiling Graphic Artifact 2 Answers

How do you calculate walls between tiles in a 3d environment? 5 Answers

Any instruments for city leveling 0 Answers

Is there something like tile pallet for Unity 3D ? 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