unity-dotween-design
Source-anchored design rules for DOTween 1.3.015 (Unity 2018+). Load before writing any DOTween.Init / DOMove / Sequence.Append / SetLoops / SetLink / AsyncWaitForCompletion / ToUniTask code to avoid missing-target NRE, tween leaks, Safe Mode false positives, autoKill confusion, module compile errors. Triggers: DOTween, DOMove, DORotate, DOScale, DOColor, DOFade, DOShakePosition, DOShakeRotation, DOPath, DOPunchScale, DOJump, DOLocalMove, DOAnchorPos, DOSizeDelta, Sequence, Tweener, TweenerCore, SetEase, SetDelay, SetLoops, SetAutoKill, SetLink, SetUpdate, SetId, SetTarget, SetRelative, SetSnapping, SetRecyclable, OnComplete, OnKill, OnStart, OnUpdate, OnStepComplete, AsyncWaitForCompletion, AsyncWaitForKill, AsyncWaitForRewind, ToUniTask, DOVirtual, PathType, PathMode, LoopType, UpdateType, DOTweenComponent, DOTweenSettings, 补间动画, 序列动画, 缓动曲线, 生命周期绑定, 动画回调, DOTween init, tween lifecycle, safe mode, tween capacity, kill target.
- License 许可
- MIT
- 最近更新
- 2026-07-25
- Stars
- ★ 8
- Forks
- 0
01 前言 Front Matter
- name
- unity-dotween-design
- metadata
- { "tier": 2, "source": "https://github.com/Besty0728/Unity-Skills", "version": "1.9.2" }
- use-when
- Load when designing or reviewing source-anchored design rules for dotween 1. Load for design advisory guidance — does not require Unity Editor running.
- platforms
- [ "unity-editor", "claude-code" ]
- description
- Source-anchored design rules for DOTween 1.3.015 (Unity 2018+). Load before writing any DOTween.Init / DOMove / Sequence.Append / SetLoops / SetLink / AsyncWaitForCompletion / ToUniTask code to avoid missing-target NRE, tween leaks, Safe Mode false positives, autoKill confusion, module compile errors. Triggers: DOTween, DOMove, DORotate, DOScale, DOColor, DOFade, DOShakePosition, DOShakeRotation, DOPath, DOPunchScale, DOJump, DOLocalMove, DOAnchorPos, DOSizeDelta, Sequence, Tweener, TweenerCore, SetEase, SetDelay, SetLoops, SetAutoKill, SetLink, SetUpdate, SetId, SetTarget, SetRelative, SetSnapping, SetRecyclable, OnComplete, OnKill, OnStart, OnUpdate, OnStepComplete, AsyncWaitForCompletion, AsyncWaitForKill, AsyncWaitForRewind, ToUniTask, DOVirtual, PathType, PathMode, LoopType, UpdateType, DOTweenComponent, DOTweenSettings, 补间动画, 序列动画, 缓动曲线, 生命周期绑定, 动画回调, DOTween init, tween lifecycle, safe mode, tween capacity, kill target.
- do-not-use-when
- Do not load as a runtime editor-automation skill — this module provides design advisory guidance only. Do not use for direct Unity Editor mutations.
- task-categories
- [ "animation", "tweening", "design-advisory" ]
02 资源文件 8
- 参考文档BASICS.md8.6 KB
- 参考文档EASE.md7.2 KB
- 参考文档INTEGRATION.md7.9 KB
- 参考文档LIFETIME.md8.7 KB
- 参考文档PITFALLS.md12.0 KB
- 参考文档SEQUENCE.md6.9 KB
- 参考文档SHORTCUTS.md17.0 KB
- 参考文档TWEEN.md8.2 KB
03 SKILL.md 正文
DOTween - Design Rules
Advisory module. Every rule is distilled from Demigiant DOTween source at:
- 1.3.015 — bundled in
_DOTween.Assembly/DOTween/andbin/Modules/module files (Unity 2018+)
Each rule cites a concrete file/line so the reasoning is auditable and the AI does not improvise against stale memory.
Mode: Documentation only — no REST skills to gate; load freely under any operating mode (Approval / Auto / Bypass).
When to Load This Module
Load before writing or reviewing any of:
DOTween.Init(...)bootstrap, DOTweenSettings configuration, SetTweensCapacity adjustments- Any
.DOMove / .DORotate / .DOScale / .DOColor / .DOFade / .DOShake* / .DOPath / .DOPunch*shortcut call DOTween.Sequence()+.Append / .Join / .Insert / .Prepend / .AppendInterval / .PrependInterval / .AppendCallback.SetEase / .SetDelay / .SetLoops / .SetAutoKill / .SetLink / .SetId / .SetTarget / .SetUpdate / .SetRelative / .SetRecyclable / .SetSpeedBased.OnStart / .OnUpdate / .OnStepComplete / .OnComplete / .OnKill / .OnPlay / .OnPause / .OnRewind.AsyncWaitForCompletion / .AsyncWaitForKill / .AsyncWaitForRewind / .AsyncWaitForElapsedLoops / .AsyncWaitForPositiontween.ToUniTask(TweenCancelBehaviour, CancellationToken)(UniTask bridge)DOTween.Kill(target, complete)/DOTween.KillAll()batch operations- Safe Mode debugging —
useSafeMode,safeModeLogBehaviour,nestedTweenFailureBehaviour - DOTween Module generation (Audio / Physics / Physics2D / Sprite / UI / UnityUI / TextMeshPro)
Critical Rule Summary
| # | Rule | Source anchor |
|---|---|---|
| 1 | DOTween.Init(recycleAllByDefault, useSafeMode, logBehaviour) returns IDOTweenInit for fluent .SetCapacity(...). If not called explicitly, Auto-init runs on first tween creation (AutoInit at DOTween.cs:236). DOTween.Version = "1.3.015" is exposed as a const. |
DOTween.cs:38,227,236,243 |
| 2 | Every tween is driven by a single [DOTween] GameObject MonoBehaviour (DOTweenComponent) marked DontDestroyOnLoad. It is created on first init and survives scene loads. Don't destroy it — DOTween.Clear(destroy: true) is the only supported teardown. |
DOTweenComponent.cs:268-270, DOTween.cs:311 |
| 3 | Default autoKill = true: tween is killed on completion. After kill, calls like .Restart() / .Kill() / .Complete() are no-ops (Safe Mode) or NullReferenceException (Safe Mode off). Use .SetAutoKill(false) to keep tween alive for replay. |
DOTween.cs useSafeMode:49, TweenSettingsExtensions.cs:39,49 |
| 4 | Safe Mode is ON by default (useSafeMode = true). Target destroyed while tween plays → Safe Mode catches the exception and logs per safeModeLogBehaviour (default: Warning). Disable Safe Mode to locate missing-link bugs during development. |
DOTween.cs:49,51 |
| 5 | SetLink(gameObject, LinkBehaviour) binds tween lifecycle to a GameObject. Default LinkBehaviour.KillOnDestroy. Without SetLink, tween continues running after target is destroyed and relies on Safe Mode for protection. |
TweenSettingsExtensions.cs:91,103, LinkBehaviour.cs |
| 6 | SetTarget(object target) is required for DOTween.Kill(target) / DOTween.KillAll(target) grouping. Shortcut extensions (.DOMove, .DOFade, etc.) set target automatically; manual DOTween.To(...) does NOT. |
TweenSettingsExtensions.cs:116, DOTween.cs:884,892 |
| 7 | Sequence.Append(t) runs after previous. Sequence.Join(t) runs in parallel with previous. Sequence.Insert(float atPosition, t) inserts at absolute time. Sequence.Prepend(t) pushes to front, shifting existing. |
TweenSettingsExtensions.cs:499,508,517,528 |
| 8 | AsyncWaitForCompletion / AsyncWaitForKill / AsyncWaitForRewind live in DOTweenModuleUnityVersion.cs (MODULE file, gated by `UNITY_2018_1_OR_NEWER && (NET_4_6 |
|
| 9 | UniTask bridge tween.ToUniTask(TweenCancelBehaviour, CancellationToken) lives in UniTask's External/DOTween/ extensions and is the recommended await path over AsyncWaitForCompletion. TweenCancelBehaviour has 9 values (Kill / Complete / CancelAwait / KillAndCancelAwait / ...). |
UniTask DOTweenAsyncExtensions.cs:14-27,54 |
| 10 | Ease enum has 38 entries (36 user-facing + 2 reserved INTERNAL_*): Unset / Linear + In/Out/InOut variants of Sine/Quad/Cubic/Quart/Quint/Expo/Circ/Elastic/Back/Bounce (10 × 3 = 30 math eases) + Flash / InFlash / OutFlash / InOutFlash. INTERNAL_Zero and INTERNAL_Custom are auto-assigned by DOTween for zero-duration and AnimationCurve-based tweens. |
Ease.cs:9-53 |
Sub-doc Routing
| Sub-doc | When to read |
|---|---|
| BASICS.md | DOTween.Init, driver GameObject, DOTweenSettings asset, Modules architecture, Safe Mode, tween capacity |
| TWEEN.md | Tween base class, Tweener vs Sequence, autoKill, Play/Pause/Rewind/Restart/Kill/Complete/Goto lifecycle |
| SEQUENCE.md | Sequence.Append / Join / Insert / Prepend / AppendInterval / PrependInterval / AppendCallback / InsertCallback, nesting, loop composition |
| SHORTCUTS.md | .DOMove / DOLocalMove / DOAnchorPos / DORotate / DOScale / DOColor / DOFade / DOPath / DOJump / DOPunch / DOShake* cheat sheet by target type |
| EASE.md | Full Ease enum, SetEase overloads (Ease / amplitude+period / AnimationCurve / EaseFunction), Flash family, Elastic/Back overshoot |
| LIFETIME.md | SetAutoKill / SetLink / SetRecyclable / SetId / SetTarget / DOTween.Kill / DOTween.KillAll, Safe Mode, tween pool capacity |
| INTEGRATION.md | DOTween + UniTask (ToUniTask), DOTween + Coroutine (WaitForCompletion), DOTween + Addressables lifetime, DOTween + Netcode deterministic replay |
| PITFALLS.md | 30 concrete hallucination / runtime pitfalls (missing target, stale tween handle, OnComplete not firing on infinite loop, Safe Mode hiding bugs, etc.) |
Routing to Other Modules
- Async integration (
ToUniTask,AsyncWaitForCompletion) → load unitask-design and async - UI animation (uGUI / UIToolkit) choice between DOTween and native animators → load inspector
- Architecture / performance review of tween-heavy scenes → load performance
- Asmdef layout for DOTween consumers (
DOTween.asmdef, DOTween Modules asmdef) → load asmdef - Addressables-loaded prefab tween lifetime (bundle unload vs tween running) → load addressables-design
Version Scope
Targets DOTween 1.3.015 (the Pro/Free source bundled in _DOTween.Assembly/). Version is exposed as the const DOTween.Version = "1.3.015" at DOTween.cs:38.
Earlier 1.2.x versions are source-compatible for most APIs. Key differences:
- Modules system (UI / TMP / Physics / etc.) requires post-1.2.0 source and the Utility Panel scanner.
SetLinkwas added in 1.2.x series;LinkBehaviour.KillOnDestroyvsKillOnDisablevariants in later 1.2/1.3.TweenCancelBehaviour(UniTask bridge) shipped separately via the UniTask package.
When in doubt, read the cited source — not your memory.
04 同仓库更多 Skills
dots-update-groups
How to choose the right ECS system group and ordering so per-frame and per-fixed-step work is deterministic and never races its own readers. Covers InitializationSystemGroup / SimulationSystemGroup / PresentationSystemGroup / FixedStepSimulationSystemGroup / VariableRateSimulationSystemGroup, UpdateBefore / UpdateAfter peer ordering, OrderFirst / OrderLast group-boundary placement, RateManager, and the cross-group ordering trap. Use when adding an ISystem, fixing "value visible one frame late" bugs, or coupling simulation to a fixed timestep.
dots-transform-patterns
The Entities 1.x transform model — LocalTransform (writable input) vs LocalToWorld (system-owned matrix), Parent/Child hierarchy, reparenting cost, uniform vs non-uniform scale (PostTransformMatrix), and when to opt out with custom transform systems. Use when designing parent/child hierarchies, runtime reparenting (mount/dismount/socket), or choosing transform components at the Baker boundary.
dots-singleton-patterns
Model cross-system shared configuration and game state as a single-entity component with a strict single-writer contract. Covers RequireForUpdate gating, SystemAPI.GetSingleton / GetSingletonRW / HasSingleton / TryGetSingleton, bake-time vs runtime-created vs ECB-system singletons, the "exactly one entity" runtime invariant, and the single-writer rule. Use when designing frame-stable global config, shared mutable state, or any component intended to exist on exactly one entity.
dots-hybrid-bridge
The one-way bridge between DOTS-owned runtime state and Unity-owned presentation. Covers UnityObjectRef for managed asset refs in components, the DOTS-writes / Unity-reads ownership rule, when to use managed IComponentData vs UnityObjectRef vs CompanionComponent, baker-bridge vs runtime-bridge, and SubScene boundary rules. Use when an entity must reference Unity assets (Mesh, Material, AudioClip, ScriptableObject), a MonoBehaviour view must read entity state, or input/UI must trigger ECS work.
dots-event-driven-ecs
Model one-frame events and external requests in ECS without dual ownership, polling, or persistent state leaks. Covers request-tag pattern with ECB, enableable command components (no structural change), event buffers (IBufferElementData), explicit consumer ownership, one-frame latency rules, and the banned C# event / UnityEvent / static bus anti-patterns. Use when input/UI/network must trigger ECS work, when a one-frame signal fans out to N consumers (damage, hit, collision), or when state changes must be processed exactly once.
valid_skill
A complete, well-formed test fixture skill for SkillHub validation testing. Covers basic task routing and code review for Unity projects.