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 the scripts grillScript = FindObjectOfType <CarGenerator0Grill> (); grillToBonnetScript = FindObjectOfType <CarGenerator1GrillToBonnet> (); bonnetScript = FindObjectOfType <CarGenerator2Bonnet> (); bonnetToWindscreenScript = FindObjectOfType <CarGenerator3BonnetToWindscreen> (); rearPanelScript = FindObjectOfType <CarGenerator7RearPanel> (); backendScript = FindObjectOfType <CarGenerator8Backend> (); //Call the create mesh function 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 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 the previous mesh script grillData = FindObjectOfType <CarGenerator0Grill> (); //Call the create mesh function 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 the scripts grillScript = FindObjectOfType <CarGenerator0Grill> (); sidePanel0Script = FindObjectOfType <SidePanel0> (); sidePanel1Script = FindObjectOfType <SidePanel1> (); //Call the create mesh function CreateMesh(); }