报错 DOTWEEN ► Max Tweens reached: capacity has automatically been increased from 200/50 to 500/50.

Unity使用DOTween显示UI时产生的报错如下图。
在这里插入图片描述

DOTWEEN ► Max Tweens reached: capacity has automatically been increased from 200/50 to 500/50. Use DOTween.SetTweensCapacity to set it manually at startup

报错原因:

由于用同一帧塞满了大量的Tween而发生的产生的报错,导致Tween数的容量溢出的警告。

解决办法:

DG.Tweening.DOTween.SetTweensCapacity(tweenersCapacity:800, sequencesCapacity:200);

如果需要消除警告,可以使用dotween.settweenscapacity函数调整tweens的容量数和序列容量。
随着tweens数量的增加,内存消耗量也会相应增加,应该适当的调整tweens容量。


参考:【Unity】DoTween:「Max Tweens reached」警告が発生した時の対処方

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
Dotween is a popular Unity asset that provides an easy-to-use interface for creating animations and tweens. To create a jump animation using Dotween, you can follow these steps: 1. Import Dotween into your Unity project. 2. Create a GameObject that you want to jump, such as a player character. 3. Create a new C# script and attach it to the GameObject. 4. In the script, add a reference to the GameObject's Transform component: ```csharp private Transform _transform; private void Start() { _transform = transform; } ``` 5. In the script's Update() method, check if the player is pressing the jump button (e.g. the spacebar): ```csharp private void Update() { if (Input.GetKeyDown(KeyCode.Space)) { Jump(); } } ``` 6. Implement the Jump() method that will apply the jump animation using Dotween. Here's an example: ```csharp private void Jump() { // Define the jump height and duration float jumpHeight = 1f; float jumpDuration = 0.5f; // Define the jump path using a DOTween Sequence Sequence jumpSequence = DOTween.Sequence(); jumpSequence.Append(_transform.DOMoveY(jumpHeight, jumpDuration / 2f).SetEase(Ease.OutQuad)); jumpSequence.Append(_transform.DOMoveY(0f, jumpDuration / 2f).SetEase(Ease.InQuad)); // Start the jump animation jumpSequence.Play(); } ``` This code uses the DOTween.Sequence() method to define a sequence of two animations that will move the player's Transform component up and then back down. The SetEase() method is used to apply easing to the animation (in this case, a quadratic ease-out for the upward motion and a quadratic ease-in for the downward motion). 7. Save the script and test the jump animation in the Unity Editor. Press the spacebar to make the player jump.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

明天不吃鱼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值