22 lines
554 B
C#
22 lines
554 B
C#
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();
|
|
}
|
|
}
|
|
}
|
|
} |