how i can do this?
My goal is to create a system where you can go down stairs by pressing the DownArrow key. try to do it with the following code:
BoxCollider2D BC2D; // Use this for initialization void Start () { BC2D = GetComponent (); }
// Update is called once per frame void Update () { if (Input.GetKey (KeyCode.DownArrow)) { BC2D.enabled =! BC2D.enabled; } else { }
} } but every time that key is pressed, the collider is generated and disappears in the form of a "bucle", also try to do it with destroy when the key is pressed, but I do not know how to make the same collider be generated in the same position when it does not is this pressing the key. Someone with more experience and knowledge that I can help please? Thanks: D![alt text][2] [2]: /storage/temp/109140-1.png
Your answer
![](https://koobas.hobune.stream/wayback/20220612150345im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Calling from another C# Script is casuing Unity 5.4 to crash in editor mode. 0 Answers
raycast2d problem enemies,Raycast2D problem 0 Answers
line rendere not aligned with collider 1 Answer
Best way to detect mouse inside radius of player? 0 Answers
Circle Collider2D Stuck ob Box Collider2D at the corner :( 0 Answers