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

Assign Material in View Unity Part 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Assign Material in View Unity Part 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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