Painting and erasing groups of tiles

Lea Hayes
Rotorz Limited
From: United Kingdom
Registered: 2014-03-04
Posts: 638

Topic

I have been asked a couple of times regarding this and so I thought that it would be useful to put a little example implementation together.

At the time of writing Rotorz Tile System does not include a feature for painting and erasing compositions of tiles or though this is on the list of requested features. Whilst not provided out-of-the-box it is possible to implement this type of functionality with custom scripts.

What's included in this example?
  • Editor tool for painting and erasing compositions.

  • Utility class for painting and erasing compositions at runtime.

  • CompositeTileMap component for finding grouped tiles.


Download Example Scripts (License: MIT)
CompositeTiles+Example_2.4.3.zip (latest)
CompositeTiles+Example_2.3.1.zip

Known Issue

Once Unity serialization has occurred in-editor (i.e. enter/exit play mode, use of undo, save scene, restart unity, etc) tile grouping data is lost. This does not effect runtime painting of tile compositions.

This issue can be resolved once Unity 4.5 has been released, so I will update the example source code when this happens.

License for Example Code

The MIT License (MIT)

Copyright (c) 2014-2016 Rotorz Limited

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Last edited by Lea Hayes (2016-02-17 12:18:05)

TrentSterling
Member
Registered: 2014-04-07
Posts: 28

Response 1

Very interesting! I can imagine it being very useful for putting together pre-made dungeon bits.

You're really helping everyone a lot with all these Rotorz 'extras'.

Lea Hayes
Rotorz Limited
From: United Kingdom
Registered: 2014-03-04
Posts: 638

Response 2

I have updated the example source in this post to utilize new features which were introduced in Rotorz Tile System 2.3.1 and Unity 4.5.

These changes hopefully make the tool a little nicer to use :)

boorch
Member
Registered: 2016-01-21
Posts: 18

Response 3

wonderful feature but i can't figure out how to set this up. I put the CompositeTilesExample in my Assets folder, Unity "compiled" scripts, but there was no >C< button on my RTS:Tools :(
What should I do?

Lea Hayes
Rotorz Limited
From: United Kingdom
Registered: 2014-03-04
Posts: 638

Response 4

boorch wrote:

wonderful feature but i can't figure out how to set this up. I put the CompositeTilesExample in my Assets folder, Unity "compiled" scripts, but there was no >C< button on my RTS:Tools :(
What should I do?

Aha, there was a compilation error in the console window due to a change in the API.

I have updated the ZIP and have provided a link to the new download in the original post.

Many thanks!

boorch
Member
Registered: 2016-01-21
Posts: 18

Response 5

you
are
my
HERO!

thanks lea!

boorch
Member
Registered: 2016-01-21
Posts: 18

Response 6

hi lea!
i followed the tutorial step by step but when i paint with composition tool, nothing seems to happen. when i hover over the tiles i painted, i can see their names on the little box bototm left of the scene window. what should i do?

edit: if i refresh all the tiles, then the painted composition group appears! i can't see any new composition i painted without refreshing all tiles of that tilesystem. which makes it kinda useless since it'll be easier to paint a 9-tile tree one by one than to refresh tilesystem everytime i paint a tree. :/

edit2: i realized if i set individual brushes of my "tree" to be non-procedural, i can see the compositions as i paint them. is that a limitation? i guess composition groups can't have procedural brushes?

Last edited by boorch (2016-06-07 16:08:57)

Lea Hayes
Rotorz Limited
From: United Kingdom
Registered: 2014-03-04
Posts: 638

Response 7

I have been unable to reproduce the issue with procedural tileset brushes.

Q1. Are there any errors appearing in the console window?

Q2. What is the exact version of Unity and Rotorz Tile System that you are experiencing this issue with?

Q3. Which OS are you experiencing this issue with?