- Home /
Question by
MTDues · Dec 21, 2017 at 04:56 AM ·
c#javascriptscripting problemscripting beginner
hello guys anyone know how to change this js to c#
please , how to change this into c#
script basicly just turn off object while turning on another same time and vice versa
#pragma strict
var A : GameObject;
var B : GameObject;
var On : boolean;
function Update () {
if (Input.GetKeyDown(KeyCode.Return)) {
if (On == true) {
On = false;
} else {
On = true;
}
}
if (On == true) {
A.SetActive(true);
B.SetActive(false);
} else {
A.SetActive(false);
B.SetActive(true);
}
}
Comment
Best Answer
Answer by Ginxx009 · Dec 21, 2017 at 05:07 AM
GameObject A;
GameObject B;
bool On;
void Update(){
if(Input.GetKeyDown(KeyCode.Return)){
if (On == true) {
On = false;
} else {
On = true;
}
}
if (On == true) {
A.SetActive(true);
B.SetActive(false);
} else {
A.SetActive(false);
B.SetActive(true);
}
}
Your answer
Follow this Question
Related Questions
Help change the subject of this Script 1 Answer
Grab/Throw Mechanic.,Grab/Throw Objects Mechanic 0 Answers
Proplem with position reset script of certain object 0 Answers
How do you check if a game object is set active using an if statement? 2 Answers
Standard Asset FP Controller not moving 0 Answers