Пример #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 the same material as the side panel
        gameObject.GetComponent <Renderer> ().material = GameObject.Find("VanSidePanel0").GetComponent <Renderer> ().material;

        //Get script of previous mesh
        rearSlant  = GameObject.Find("Van9RearSlant").GetComponent <Van9RearSlant> ();
        sideWindow = GameObject.Find("VanSideWindow0").GetComponent <VanSideWindow0> ();

        //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)];

        //Get script of previous mesh
        rearSlant = FindObjectOfType <Van9RearSlant> ();

        //Create the mesh
        CreateMesh();
    }