Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
1
Question by IamDumb · Apr 16, 2019 at 07:23 PM · 2dunity 2dtilemaptile

Changing Size of Tilemap

How do I change the size of a tilemap? I'm probably missing something really obvious here, but I can't seem to change the size of my tilemap. Currently, it's stuck 5x6 but I want to be 20x20. Is there any way to change this?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by TheKnightsofUnity · Apr 19, 2019 at 03:44 PM

Hello @IamDumb !
There are a few different ways of resizing the tilemap, each comes with a different result:

1. Change the Scale or Cell Size of Grid – when you create a new Tilemap, Unity will automatically generate two game objects: a Grid with a Tilemap child. You can change the Scale field of the Grid’s transform or Cell Size in the Grid component. Changing the scale will stretch all tiles in the tilemap, whereas changing the Cell Size will leave the tiles unchanged – only the actual size of a cell will be changed.

2. Scale the game object with Tilemap component attached – this will stretch all tiles in all scaled directions,

3. Change orientation to Custom – by changing the Orientation field of Tilemap component, the Scale fields are now editable. Changing this field will resize the sprite of each tile, leaving the actual cell size untouched (this might cause tiles to overlap),

4. Change the size of the particular tiles – by clicking on a tile in a Tile Palette window will show Grid Selection in the Inspector. You can change the Scale field of a tile, which have a similar effect as step 3, but will affect only a particular tile.

We hope one of the solutions we suggested will solve your problem!


All the best,
The Knights of Unity

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
avatar image
3

Answer by Atimlotus · Nov 24, 2019 at 05:58 PM

Hello @IamDumb,

I was trying to manually set the size of a tilemap today and the values I was getting from the script API just weren't making sense to me.

tilemap.cellBounds, tilemap.size, tilemap.localBounds were all showing me dimensions that didn't match what I was seeing in my scene.

What I found was that enabling "Debug Mode" allowed me to view and change the size of the tilemap in the inspector. Debug mode can be enabled by clicking the dropdown button next to the lock icon at the top right of the inspector window.

One thing I noticed after doing this was that painting tiles in the scene will automatically change the size of the tilemap if you go outside of the defined bounds of the tilemap. So if you have your 20x20 size tilemap and you paint in a tile one space to the right of the right bounds the tilemap will resize to 21x20.

Comment
Add comment · Show 2 · 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 Gothbag · May 29, 2020 at 03:13 AM 0
Share

So how did you fix this? How does one make the tilemap smaller back again?

Thanks

avatar image gameraccount1338 Gothbag · Jun 01, 2020 at 08:59 AM 0
Share

@Gothbag From what I can see in testing Tilemap.size does not automatically resize itself when you erase tiles in the scene view.

There does appear to be a function that will automatically resize the bounds of the tilemap based on it's current contents. In script you'd call Tilemap.CompressBounds(). To use the same function in the inspector/editor the inspector needs to be in debug mode. In the scene hierarchy select the game object that has the tilemap component you're trying to resize. In the inspector go to the Tilemap component and open the component settings by clicking on the 3 stacked dots on the far right side of the component's titlebar. At the bottom of the menu that opens you should see "Compress Tilemap Bounds".

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

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

2D tilemaps - separation of view and data, prototyping doubts 0 Answers

How can I modify the sprite of a particular Scriptable Tile in a Tilemap? 2 Answers

How to reference a float from a specific tile? 1 Answer

Making 2D Tilemap Areas Impassible During Runtime? 0 Answers

How to get which Tile in a tilemap another GameObject collided with? 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