U3DC.COM | 优三帝研究院

Menu

DoTween官方文档中文版(三)DOTween.Init

DOTween.Init(初始化)

The first time you create a tween, DOTween will initialize itself automatically, using default values.

If instead you prefer to initialize it yourself (recommended), call this methods once, BEFORE creating any tween (calling it afterwards will have no effect).

Consider that you can still change all init settings whenever your want, by using DOTween'sglobal settings

Optionally, you can chain SetCapacity to the Init method, which allows to set the max Tweeners/Sequences initial capacity (it's the same as calling DOTween.SetTweensCapacitylater).

第一创建补间DOTween 自动初始化自身使用默认
如果倾向于自己手动将初始化(推荐),调用一次方法,在创建任何补间之前,(如果创建之后才调用则无效果)。
考虑可以更改所有初始化设置每当想要通过使用 DOTween 的全局设置
(可选 可以链接 SetCapacity Init 方法允许设置最大的中立者/序列初始容量 (它以后调用 DOTween.SetTweensCapacity 相同)。
static DOTween.Init(bool recycleAllByDefault = false, bool useSafeMode = true, LogBehaviourlogBehaviour = LogBehaviour.ErrorsOnly)
Initializes DOTween. Call it without any parameter to use the preferences you set in DOTween's Utility Panel (otherwise they will be overrided by any eventual parameter passed).
recycleAllByDefault If TRUE all new tweens will be set for recycling, meaning that when killed they won't be destroyed but instead will be put in a pool and reused rather than creating new tweens. This option allows you to avoid GC allocations by reusing tweens, but you will have to take care of tween references, since they might result active even if they were killed (since they might have been respawned and might now be in use as other completely different tweens).
If you want to automatically set your tween references to NULL when a tween is killed you can use the OnKill callback like this:
初始化 DOTween调用不带任何参数,使用DOTween 的实用程序面板设置首选项 (否则他们脑子里自然传递任何最终参数)。
如果TRUE创建的所有补间设置回收意思杀害他们recycleAllByDefault 不会破坏相反一个池子重用而不是创建补间选项允许避免 GC 分配通过重用补间动画但是不得不照顾补间引用因为他们可能会导致积极即使他们杀害 (因为它们可能会respawned现在可能正在使用作为其他完全不同补间)。
如果自动设置补间引用 NULL,当补间杀害可以使用 OnKill 回调这样
.OnKill(()=> myTweenReference = null)

You can change this setting at any time by changing the static DOTween.defaultRecyclable property, or you can set the recycling behaviour for each tween separately, using SetRecyclable
useSafeMode If set to TRUE tweens will be slightly slower but safer, allowing DOTween to automatically take care of things like targets being destroyed while a tween is running.
WARNING: on iOS safeMode works only if stripping level is set to "Strip Assemblies" or Script Call Optimization is set to "Slow and Safe".
logBehaviour Depending on the chosen mode DOTween will log only errors, errors and warnings, or everything plus additional informations.

可以通过更改静态DOTween.defaultRecyclable 属性更改设置任何时间或者可以设置每个补间回收行为分开使用 SetRecyclable
如果设置 TRUE补间更安全允许 DOTween 自动照顾之类目标摧毁补间运行useSafeMode
警告: 安全模式 iOS作品只有剥离级别设置"地带组件"脚本调用优化设置"慢速安全"。
根据空房模式 DOTween logBehaviour 记录错误 错误警告一切加上额外信息
// EXAMPLE A: initialize with the preferences set in DOTween's Utility Panel
DOTween.Init();
// EXAMPLE B: initialize with custom settings, and set capacities immediately
DOTween.Init(true, true, LogBehaviour.Verbose).SetCapacity(200, 10);
打赏
— 于 共写了2773个字
— 文内使用到的标签:

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据