private void Update() { if (!_fadeOnStart || _isFinished) { return; } _curTime += (Time.deltaTime); float t = Mathf.Clamp01(_curTime / _time); float curveAlpha = _alphaCurve.Evaluate(t); var color = _fadeText.color; color.a = _fadeText.color.a * curveAlpha; _fadeText.color = color; if (t >= 1.0f) { _isFinished = true; OnFadingFinished.Invoke(this.gameObject); if (_rootObj != null) { Destroy(_rootObj); } } }
private void Update() { _curTime += (Time.deltaTime); float t = Mathf.Clamp01(_curTime / _time); float curveAlpha = _alphaCurve.Evaluate(t); var color = _fadeImage.color; color.a = _fadeImage.color.a * curveAlpha; _fadeImage.color = color; if (t >= 1.0f) { OnFadingFinished.Invoke(this.gameObject); Destroy(_rootObj); } }