using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TrailColor : MonoBehaviour {
//新增陣列放TrailRenderer這個物件進去
public TrailRenderer[] myTrailRenderer;
//把所有的TrailRenderer改變成綠色
public void chageColorGreen () {
foreach(TrailRenderer i in myTrailRenderer)
{
i.startColor = Color.green;
i.endColor = Color.white;
}
}
//把所有的TrailRenderer改變成綠色
public void chageColorRed () {
foreach(TrailRenderer i in myTrailRenderer)
{
i.startColor = Color.red;
i.endColor = Color.white;
}
}
}
以上顏色回由轉淡
startColor 是開始的顏色
endColor 是結束時的顏色
@copyright MRcodingRoom
觀看更多文章請點MRcoding筆記
觀看更多文章請點MRcoding筆記