- Home /
Getting the Collider of a Tile
I have made an in-game level editor for my users. They can add tiles and other objects. When they add the player, I check if there's a tile there, and if so, I do not add the player:
 RuleTile tile = platforms.GetTile<RuleTile>(tileVector);
 if (!platforms.HasTile(tileVector) ) {
     player = Instantiate(playerPrefab, worldVector, Quaternion.identity);
 }  
However, I also want to do the opposite. If the player has already been placed, and a user tries to add a tile where he is, I want to deny that. My thoughts were to create the tile, check if the tile collides with the player, and if so delete the tile. Something like this: RuleTile tile = platforms.GetTile(tileVector);
 Collider c = tile.GetCollider(); // this is my problem, there is no such thing and I cant find anything else that helps
 
 if (playerCollider.IsTouching(c))
 {
                     platforms.SetTile(tileVector, null);
 }
Any suggestions? Can I get the collider somehow? Do you have another idea how to do it without the collider?
Your answer
 
 
             Follow this Question
Related Questions
How do I make the Collider match the sprite? 2 Answers
How to create animated tile that plays only once 0 Answers
Get tile coordinates 1 Answer
2D Tiles and sprites 1 Answer
Tilemap has gap between tiles, how do I get rid if it. 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                