0% found this document useful (0 votes)
11 views

Assign Material in view Unity part 1

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Assign Material in view Unity part 1

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

You just create a script and put in the scene this file have for parts, follow

comment p1
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;

[InitializeOnLoad]
public class EditorStartup
{
static EditorStartup()
{
// PART 1. Hi

Debug.Log(" ------------ Wellcome to Scrip to change multiple objects


------------");

// PART 2. WRITE YOUR MATEARIAL instead "Roof AI" your material,


// if it's pink chack that yor material exits in Assets\Resources\
YourMaterial.mat
// if not xist creat these folder and copy/past here your material
Material newMat = Resources.Load("Roof AI", typeof(Material)) as
Material;

// PART 3. WRITE YOUR GAME OBJECT instead "81_31_10"


GameObject obj = GameObject.Find("981_31_10");
MeshRenderer[] meshs =
obj.GetComponentsInChildren<MeshRenderer>();

Debug.Log("------------ 2. Model loaded!");


// PART 4. Assignement errors
foreach (MeshRenderer mesh in meshs)

You might also like