// Use this for initialization void Start() { if (buttonToReactTo == null) { buttonToReactTo = GetComponent <Button>(); } if (buttonToReactTo == null) { Debug.LogWarning("No button to react to, disabling color change script", gameObject); enabled = false; return; } r = GetComponent <SuperspectiveRenderer>(); if (r == null) { r = gameObject.AddComponent <SuperspectiveRenderer>(); } if (useMaterialAsEndColor) { pressColor = r.GetMainColor(); pressEmission = r.GetColor("_EmissionColor"); } if (useMaterialAsStartColor) { startColor = r.GetMainColor(); startEmission = r.GetColor("_EmissionColor"); } else { r.SetMainColor(startColor); r.SetColor("_EmissionColor", startEmission); } buttonToReactTo.OnButtonPressFinish += ButtonPressFinish; buttonToReactTo.OnButtonUnpressFinish += ButtonUnpressFinish; }
void Start() { thisRenderer = GetComponent <SuperspectiveRenderer>(); solutionColor = thisRenderer.GetMainColor(); solutionEmissionColor = thisRenderer.GetColor("_EmissionColor"); }