Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Script Problem

Discussion in 'Editor & General Support' started by GameDevAcademyy, Jul 14, 2019.

  1. GameDevAcademyy

    GameDevAcademyy

    Joined:
    Jan 11, 2019
    Posts:
    34
    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:
    10,004
  3. GameDevAcademyy

    GameDevAcademyy

    Joined:
    Jan 11, 2019
    Posts:
    34