架构大更

This commit is contained in:
SoulliesOfficial
2026-03-20 11:56:50 -04:00
parent e60ef64d01
commit d09b58fd80
3663 changed files with 15232012 additions and 105579 deletions

View File

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