- Home /
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 off
Answer by JackhammerGaming · Sep 19, 2020 at 05:19 AM
@Sad_Man30 That's easy to do in 2 ways!
Create an empty gameObject and just add a box collider to it and you're done!
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) ;
}
Your answer
Follow this Question
Related Questions
2D Rotation for aiming problem 1 Answer
2d top-down rpg direction check 1 Answer
How to get an enemy to go to a location and then return. 1 Answer
Prefab to a tile script 0 Answers
2D character Animation-controller 1 Answer