- Home /
Look left or right line will disable
Hi I want to disbled game object when i press button left or right. When my object reach in correct postion it will enable automatically.
Here is my code
if (Input.GetKey(KeyCode.RightBracket)){ transform.Translate(-new Vector3(speed * Time.deltaTime, 0,0)); Object.SetActive(false);}
if (Input.GetKey(KeyCode.LeftBracket)){ transform.Translate(new Vector3(speed * Time.deltaTime, 0 ,0)); Object.SetActive(true);}
when I press LeftBracket button my object is disabled and when I press RightBracketbutton my object is enable but I want when camera will rech in correct postion it will enable automatically.
Your answer
![](https://koobas.hobune.stream/wayback/20220612211644im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to get all gameObjects with a script on them 1 Answer
How to use On-Screen Buttons in unity 5 {URGENT} 1 Answer
How do I add force based on rotation status of a sprite? 1 Answer
How to lock rotation in z of my camera while rotating the camera by using mobile gyroscope input 0 Answers
Using a rotation in an if statement 0 Answers