using System.Collections; using System.Collections.Generic; using UnityEngine; public class MaterialTransparency : MonoBehaviour { private Renderer _renderer; private void Awake() { _renderer = GetComponent(); } 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; } }