-1

I am trying to create a game using tilemap. Walls and background are not enough for me, what can I create using tiles. I need doors, coins and similar interactive tiles. That can perform actions and / or store information.

I created a script that extends tile. But then I could not find the tile I needed. Collision does not respond to them. It is impossible to get a specific tile from a tilemap and access the desired method.

How is it possible to implement it?

Clarification: i want to create an interactive tile like doors or bushes in pokemon red game

Cixo
  • 7
  • 2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 20 '23 at 11:21

1 Answers1

0

Tiles have a GameObject.

Assuming you're build something in 2D, you'll need to add a BoxCollider2D component to it.

Then, if what you are dealing is an object that moves, you'll need to add as well a Rigidbody2D component. If the object doesn't move at all, then mark it as static instead.

You can then track when the colliders interact with, for example, OnCollisionEnter2D.

Tiago Martins Peres
  • 14,289
  • 18
  • 86
  • 145