79748886

Date: 2025-08-28 09:32:37
Score: 0.5
Natty:
Report link

Solving the problem through Unitask

using Cysharp.Threading.Tasks;
using DG.Tweening;
using UnityEngine;
public class WindowStartAnimation : MonoBehaviour
{
    [SerializeField] private GameObject _window;
    private UIAnimation _UIAnimation;
    [SerializeField] private float _animDuration;
    private async UniTask StartAnimationTask()
    {
        await UniTask.Yield();
        await UniTask.NextFrame();
        _UIAnimation = new();
        if(_window != null)
            _UIAnimation.UIScale(_window, new Vector3(0.4f, 0.4f), Vector3.one, _animDuration, Ease.OutBack, false);
    }
    private void Start()
    {
        StartAnimationTask().Forget();
    }
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Aleksey Kon