MeshRenderer의 Material 값의 Emission을 변환시킴.








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EmissionTest : MonoBehaviour
{
Color color = new Color(0, 0, 0);
float speed = 1;
float emission = 0;
Material mat = null;
private void Start()
{
mat = GetComponent<MeshRenderer>().material;
}
private void LateUpdate()
{
mat.SetColor("_EmissionColor", color);
emission = Mathf.PingPong(speed * Time.time, 1.0f);
color.b = emission;
color.g = emission;
color.r = emission;
}
}
| cs |
댓글
댓글 쓰기