1
This commit is contained in:
22
Unity/Scripts/Utils/InstanceMaterials.cs
Normal file
22
Unity/Scripts/Utils/InstanceMaterials.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Sirenix.OdinInspector;
|
||||
using System.Linq;
|
||||
namespace BITKit
|
||||
{
|
||||
public class InstanceMaterials : SerializedMonoBehaviour
|
||||
{
|
||||
[Button]
|
||||
[ContextMenu(nameof(Excute))]
|
||||
public void Excute()
|
||||
{
|
||||
if (TryGetComponent<Renderer>(out var m_renderer))
|
||||
{
|
||||
m_renderer.materials = m_renderer.sharedMaterials
|
||||
.Select(Instantiate)
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user