using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class FloorsRayCast : MonoBehaviour
{
private Material[] materials;
void Start()
{
materials = transform.parent.GetComponent<Renderer>().materials;
}
void Update()
{
if (Input.GetMouseButtonDown(0))
{
for (int i = 0; i < materials.Length; i++)
{
materials[i].DOFloat(2.77f, "_Dissolve", 2);
}
}
}
}
这段要在很多物体上执行,每个DOFLOAT要单独设数值.怎么把这段代码写成个总的然后按条件执行