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 HauntedBees · Nov 04, 2015 at 08:06 AM · c#gameobjectoptimizationpuzzle

Using fewer Game Objects in a Tile-Based Puzzle Game?

I'm working on a matching-tile puzzle game where the player can move tiles, a row at a time - or every row at once. However, the player can also move certain columns of tiles up in certain circumstances. When the user moves a row to the left, the leftmost tile will be moved to the far right, and vice versa when moving to the right.

image of the game board

Right now, each individual tile is its own Game Object with a sprite in it, which means that with a single row movement, 8 GameObjects are being moved (tweening is handled with the DOTween library), and in some instances it's possible for up to 256 tiles/Game Objects to be moving at once.

The game runs at a solid 60fps even when this is happening on all of the computers I've tested it on, but once over 100 Game Objects are being moved at once, this leads to some slowdown in console development, and presumably on slower computers.

Is there a better way of handling this than having a separate Game Object for each tile?

tiles.png (74.0 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

1 Reply

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

Answer by GiyomuGames · Nov 04, 2015 at 08:32 AM

There is at least one other way which I have personally implemented in my tile base platformer. I used to have 1 sprite / tile but performance-wise it was definitely not optimal. Now I use MeshRenderer to draw each group of tiles (4x10 tiles for example is now just 1 object with 1 mesh).

In your case in the end you could have 1 game object rendering all your tiles as the grid is already defined (let's call it "AllTiles"). You will never have to actually move game objects, just to update the status of your tiles internally and update AllTiles accordingly by telling him which textures to draw at which position of your grid / mesh.

I learnt how to do it with this tutorial: http://studentgamedev.blogspot.jp/2013/08/unity-voxel-tutorial-part-1-generating.html

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 HauntedBees · Nov 08, 2015 at 05:52 PM 0
Share

Thank you! This probably seems like the best way of implementing this sort of thing.

Now I just need to figure out if this is worth the cost - right now I'm using DOTween for animation, and if I went this route it looks like I'd have to write all that tweening and animation logic from scratch.

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

Number of scripts per Object. Optimization question. 1 Answer

Distribute terrain in zones 3 Answers

Mesh.CombineMeshes does not work when mergeSubMeshes=false 2 Answers

Multiple Cars not working 1 Answer

Mirroring a game object to create symmetry 2 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