Search Unity

Script Problem

Discussion in 'Editor & General Support' started by GameDevAcademyy, Jul 14, 2019 at 3:23 PM.

  1. GameDevAcademyy

    GameDevAcademyy

    Joined:
    Jan 11, 2019
    Posts:
    18
    What's up guys, I have a problem with a script that was made in js, i want to convert in c# - help me.

    Script:


    #pragma strict

    var carSelected : int;

    var r8 : GameObject;
    var f458 : GameObject;
    var sls : GameObject;


    function Start () {

    carSelected = GameObject.Find("DataHandler").GetComponent(DataHandler).carSel;

    if (carSelected == 1) {
    r8.SetActive (true);
    f458.SetActive (false);
    sls.SetActive (false);
    }

    else if (carSelected == 2) {

    r8.SetActive (false);
    f458.SetActive (true);
    sls.SetActive (false);
    }

    else if (carSelected == 3) {

    r8.SetActive (false);
    f458.SetActive (false);
    sls.SetActive (true);
    }
    }

    function Update () {

    }
     
  2. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    3,891
  3. GameDevAcademyy

    GameDevAcademyy

    Joined:
    Jan 11, 2019
    Posts:
    18