This commit is contained in:
SoulliesOfficial
2026-04-01 12:23:27 -04:00
parent aff7ac0e03
commit c3b1561375
933 changed files with 114333 additions and 119360 deletions

View File

@@ -1,3 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -6,24 +8,27 @@ namespace SpriteShadersUltimate
[AddComponentMenu("Sprite Shaders Ultimate/Utility/Material Instancer SSU")]
public class MaterialInstancerSSU : InstancerSSU
{
private void Awake()
void Awake()
{
var graphic = GetComponent<Graphic>();
if (graphic != null)
Graphic graphic = GetComponent<Graphic>();
if(graphic != null)
{
graphic.material = Instantiate(graphic.material);
runtimeMaterial = graphic.materialForRendering;
}
var renderer = GetComponent<Renderer>();
if (renderer != null)
Renderer renderer = GetComponent<Renderer>();
if(renderer != null)
{
var materials = renderer.sharedMaterials;
for (var n = 0; n < materials.Length; n++) materials[n] = Instantiate(materials[n]);
Material[] materials = renderer.sharedMaterials;
for(int n = 0; n < materials.Length; n++)
{
materials[n] = Instantiate(materials[n]);
}
renderer.materials = renderer.sharedMaterials = materials;
runtimeMaterial = materials[0];
}
}
}
}
}