Example #1
0
    void Start()
    {
        //Create a mesh filter while also assigning it as a variable to get the mesh property
        MeshFilter meshFilter = gameObject.AddComponent <MeshFilter> ();

        //Create a mesh renderer so we can actually display the mesh
        gameObject.AddComponent <MeshRenderer> ();

        //Set the mesh object to be that of the mesh from the mesh filter
        mesh = meshFilter.mesh;

        //Set a random material
        Object[] loadedMaterials = Resources.LoadAll("Materials");
        gameObject.GetComponent <Renderer> ().material = (Material)loadedMaterials [Random.Range(0, loadedMaterials.Length - 2)];

        rearBody    = FindObjectOfType <Classic6RearBody> ();
        frontBumper = FindObjectOfType <Classic1FrontBumper> ();
        CreateMesh();
    }
Example #2
0
    void Start()
    {
        //Create a mesh filter while also assigning it as a variable to get the mesh property
        MeshFilter meshFilter = gameObject.AddComponent <MeshFilter> ();

        //Create a mesh renderer so we can actually display the mesh
        gameObject.AddComponent <MeshRenderer> ();

        //Set the mesh object to be that of the mesh from the mesh filter
        mesh = meshFilter.mesh;

        //Set a random material from the "Resources/" folder. Length - 2 to avoid Window & Wheel texture
        Object[] loadedMaterials = Resources.LoadAll("Materials");
        gameObject.GetComponent <Renderer> ().material = (Material)loadedMaterials [Random.Range(0, loadedMaterials.Length - 2)];

        //Get script of previous mesh
        frontBumper = FindObjectOfType <Classic1FrontBumper> ();

        //Create the mesh
        CreateMesh();
    }
    void Start()
    {
        //Create a mesh filter while also assigning it as a variable to get the mesh property
        MeshFilter meshFilter = gameObject.AddComponent <MeshFilter> ();

        //Create a mesh renderer so we can actually display the mesh
        gameObject.AddComponent <MeshRenderer> ();

        //Set the mesh object to be that of the mesh from the mesh filter
        mesh = meshFilter.mesh;

        //Set a random material
        Object[] loadedMaterials = Resources.LoadAll("Materials");
        gameObject.GetComponent <Renderer> ().material = (Material)loadedMaterials [Random.Range(0, loadedMaterials.Length - 2)];

        frontBumper       = GameObject.Find("Classic1FrontBumper").GetComponent <Classic1FrontBumper> ();
        upwardFrontBumper = GameObject.Find("Classic3UpwardFrontBumper").GetComponent <Classic3UpwardFrontBumper> ();
        bonnetPartA       = GameObject.Find("Classic4BonnetPartA").GetComponent <Classic4BonnetPartA> ();
        bonnetPartB       = GameObject.Find("Classic4BonnetPartB").GetComponent <Classic4BonnetPartB> ();
        rearBody          = GameObject.Find("Classic6RearBody").GetComponent <Classic6RearBody> ();
        rearBottom        = GameObject.Find("Classic8RearBottom").GetComponent <Classic8RearBottom> ();
        CreateMesh();
    }