21 lines
476 B
C#
21 lines
476 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class MaterialTransparency : MonoBehaviour
|
||
|
{
|
||
|
private Renderer _renderer;
|
||
|
|
||
|
private void Awake()
|
||
|
{
|
||
|
_renderer = GetComponent<Renderer>();
|
||
|
}
|
||
|
|
||
|
public void SetValue(float value)
|
||
|
{
|
||
|
Color oldColor = _renderer.material.color;
|
||
|
Color newColor = new Color(oldColor.r, oldColor.g, oldColor.b, value);
|
||
|
_renderer.material.color = newColor;
|
||
|
}
|
||
|
}
|