// Start is called before the first frame update void Start() { info = GetComponentInParent <HandDebugInfo>(); parent = transform.parent; transform.SetParent(null); rigidbody = GetComponent <Rigidbody>(); }
// Update is called once per frame void Update() { if (!info) { info = GetComponent <HandDebugInfo>(); } if (materialProperty == null) { materialProperty = new MaterialPropertyBlock(); } materialProperty.SetColor("_BaseColor", forceGradient.Evaluate(info.force)); for (int i = 0; i < rs.Length; i++) { rs[i].SetPropertyBlock(materialProperty); } }