Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule Tile interaction with other tiles #249

Open
DVonk opened this issue Nov 24, 2020 · 5 comments
Open

Rule Tile interaction with other tiles #249

DVonk opened this issue Nov 24, 2020 · 5 comments

Comments

@DVonk
Copy link

DVonk commented Nov 24, 2020

Hi,
I'm trying to use rule tiles to draw some ledges. It works, but the interaction with other tiles seems really hard to grasp. I've made a rule tile for the ground and one for ledges. Now I want to add stairs. But it looks like this:

grafik

  • The left is what happens when I draw on the same layer and interupt the rule tile.
  • The right is how it should look like. I've drawn the stairs on a layer above the ledge, but now the collisions don't work properly, since Unity is still using the rule tile's collider:
    grafik

How is this meant to be done? I can't delete individual rule tiles as I'll get the left version. But I can't draw on top of the rule tiles as their collider still exists.

I was thinking about making a second rule tile for the stairs, but it has to interact with the ledge rule tile for this to work properly. Is there an easy solution to this or can this be done with a custom rule script?

@ChuanXin-Unity
Copy link
Collaborator

You could use a custom Rule Tile for the stairs which also interacts with the ledge Rule Tile.

There is an example here:
https://github.com/Unity-Technologies/2d-techdemos/tree/master/Assets/Tilemap/Rule%20Tiles/Rule%20Override%20Tile

The ExampleSiblingRuleTile defines a normal clothesline and a clothesline with clothes as Siblings, so that they can interact with each other. The clothesline with clothes overrides the standard clothesline with Sprites with clothes with the same Rules. You could use the same for the stairs, including changing the collider type as well.

Let us know if that works out for you!

@DVonk
Copy link
Author

DVonk commented Nov 26, 2020

Seems to work pretty well, thank you. I actually wish that this kind of functionality was built into the rule tiles. It seems that whenever I use Tilemap this exact problem comes up. It's pretty rare that I don't want to put in some other tile that "breaks" the rule tiles.

@ChuanXin-Unity
Copy link
Collaborator

ChuanXin-Unity commented Nov 27, 2020 via email

@johnsoncodehk
Copy link
Contributor

I don't recommend it to be provide by the repo... it has too much freedom. But maybe we can provide multiple custom rule tile template as suggested implementation for example.

@ChuanXin-Unity
Copy link
Collaborator

I guess it would be useful if it was included as a Sample in the package which can be installed in the Package Manager, although adding Script files there require a bit of management for each different version of the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants