how can i make a invisible wall

i want to make a invisible wall that say “you dont have anything to do there” and then it will bounce you back off167777-ui.png

@Sad_Man30 That’s easy to do in 2 ways!

  1. Create an empty gameObject and just add a box collider to it and you’re done!
  2. However if you’re having a wall sprite and wanna make that invisible just go to sprite renderer and disable the component make sure that it has a collider if you wanna make the wall visible again you just have to enable the sprite renderer again!

Though i think 1st way is all you need. For saying that you need few lines of code

public GameObject text; // your text ui

OnCollisionEnter2D (Collision2D other){
       text.SetActive(true) ;

OnCollisionExit2D (Collision2D other){
       text.SetActive(false) ;