Community写作与编辑github.com

juice-kit

把 Juice Kit(一組不需要素材、不需要付費插件的 Unity C# 腳本)安裝或更新到 Unity 專案的 Assets/Juice。所有 juice-* Skill 都需要它。使用者說「安裝 Juice Kit」「安裝 Juice Skills」,或專案出現找不到 Juice、JuiceShake、JuiceSfx 等類別的編譯錯誤時使用。Installs the Juice Kit runtime scripts into a Unity project.

juice-kit 是什么?

juice-kit is a Claude Code agent skill that 把 Juice Kit(一組不需要素材、不需要付費插件的 Unity C# 腳本)安裝或更新到 Unity 專案的 Assets/Juice。所有 juice-* Skill 都需要它。使用者說「安裝 Juice Kit」「安裝 Juice Skills」,或專案出現找不到 Juice、JuiceShake、JuiceSfx 等類別的編譯錯誤時使用。Installs the Juice Kit runtime scripts into a Unity project.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/yayapipi/unity-juice-skills/tree/HEAD/skills/juice-kit

Installed? Explore more 写作与编辑 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Juice Kit: Installation & Overview

Juice Kit is 24 C# scripts plus two Shaders (each with a Unity .meta file). Everything is generated programmatically—no assets, Prefabs, or paid plugins required. All other juice-* skills teach you how to use these scripts.

Installation Steps

  1. Locate the Unity project root: the folder containing both Assets/ and ProjectSettings/.
  2. Check if already installed: if Assets/Juice/Juice.cs exists, read its Version. If it matches this skill's version (1.0.1), no reinstallation is needed—stop here.
  3. Copy contents: copy everything inside this skill's unity/Juice/ folder into the project's Assets/Juice/, preserving subfolders UI, Resources, Demo, Editor and all .meta files. Use the same command for first-time install and updating an older version; existing files will be overwritten:
    • macOS, Linux: mkdir -p "<project>/Assets/Juice" && cp -R "<path to this skill>/unity/Juice/." "<project>/Assets/Juice/"
    • Windows PowerShell: New-Item -ItemType Directory -Force "<project>\Assets\Juice" | Out-Null; Copy-Item -Recurse -Force "<path to this skill>\unity\Juice\*" "<project>\Assets\Juice\"
    • The trailing /. and \* on the source are critical: without them, if Assets/Juice already exists, contents get copied into Assets/Juice/Juice, causing duplicate scripts and build failures. After copying, verify that Assets/Juice/Juice/ does not exist.
    • If this skill's folder doesn't contain unity/Juice, fetch it from GitHub: git clone --depth 1 https://github.com/yayapipi/unity-juice-skills, source is skills/juice-kit/unity/Juice.
  4. Check for uGUI: if Packages/manifest.json does not have com.unity.ugui, delete Assets/Juice/UI/ and Assets/Juice/UI.meta (the two files inside require Unity UI).
  5. Wait for Unity to compile, ensure no errors in the Console. If you have tools to read the Console (Unity CLI, Unity MCP), read it yourself; otherwise, ask the user to switch back to Unity and check.
  6. Report: tell the user where it was installed, and that they can use the menu Tools ▸ Juice ▸ Create Demo Scene to see a demo.

The .meta files contain fixed GUIDs and must be copied along: scenes and Prefabs rely on those GUIDs to find components like JuiceFeedback and JuiceButton. Without them, updating the Kit later will cause Missing Script errors on those components. The Assets/Juice folder's own .meta file is generated by Unity.

When Project Scripts Are in asmdef

Juice Kit compiles into Assembly-CSharp by default; scripts inside an asmdef cannot reference it. Only in this case: add a JuiceKit.asmdef in Assets/Juice/ (references: add UnityEngine.UI), and an Editor-only JuiceKit.Editor.asmdef in Assets/Juice/Editor/ (references: add JuiceKit), then have your project's asmdef reference JuiceKit. If the project does not use asmdef, do not add any.

What's Inside

ClassOne-LinerMost Common One-Liner
JuiceOne-line recipes for common eventsJuice.Hit(enemy.gameObject, hitPoint);
JuiceShakeCamera shake, recoil, zoomJuiceShake.Add(0.4f);
JuiceTimeHit stop, slow motionJuiceTime.HitStop(0.06f);
JuiceSquashSquash, stretch, punchJuiceSquash.Squash(transform);
JuiceFlashWhite flashJuiceFlash.Play(gameObject);
JuiceBurstSparks, dust, explosions, confettiJuiceBurst.Spark(point);
JuiceTrailMotion trailJuiceTrail.Attach(gameObject, Color.cyan);
JuiceSfxRandom pitch, combo scales, built-in synth soundsJuiceSfx.Blip(JuiceBlip.Jump);
JuiceFloatingTextDamage numbers, floating textJuiceFloatingText.Spawn(point, "12");
JuiceFeedbackCombines all above in one component, tweak in Inspectorfeedback.PlayAt(point);
JuiceButtonUI button hover, press, releaseAttach to button
JuiceCounterScore rollingcounter.Set(score);
JuicePopPop-in on object spawnAttach to object
JuiceTypewriterDialogue text appearancetypewriter.Play(line);
JuiceFadeFade in/out transitionsJuiceFade.LoadScene("Level2");
JuiceJumpAssistCoyote time, jump bufferPut in character controller
JuiceFollowCameraDamped camera follow, look-ahead, dead zoneAttach to camera
JuiceSettingsToggle shake & flash for playersJuiceSettings.ScreenShake = false;
JuiceEase, JuiceRunnerEasing curves and minimal tweeningJuiceRunner.Tween(0.3f, e => ...);

All static feedback calls automatically create required objects (camera components, particle systems, AudioSource) at runtime—no need to place anything in the scene beforehand. Calling them in edit mode (not Play) does nothing and causes no errors.

What's Inside a One-Line Recipe

RecipeEquivalent Lines
Juice.Hit(target, point, power)JuiceTime.HitStop(0.06f * power), JuiceShake.Add(0.3f * power), JuiceFlash.Play(target), JuiceSquash.Punch(target.transform, 0.15f * power), JuiceBurst.Spark(point), JuiceSfx.Blip(JuiceBlip.Hit)
Juice.Hurt(target, power)HitStop(0.1f * power), Add(0.5f * power), JuiceFlash.Play(target, red, 0.1f), JuiceSquash.Squash(target.transform, 0.2f * power), Blip(Hurt)
Juice.Jump(transform)JuiceSquash.Stretch(transform, 0.22f), JuiceBurst.Dust(feet), Blip(Jump, 0.4f)
Juice.Land(transform, impact)JuiceSquash.Squash(transform, 0.25f * impact), JuiceBurst.Dust(feet), Blip(Land, 0.4f); add Add(0.12f * impact) if impact >= 1.5
Juice.Pickup(position, color, text)JuiceBurst.Spawn(position, color, 8, 4f, 0.14f, 0.35f), Blip(Pickup); add JuiceFloatingText.Spawn if text is provided
Juice.Coin(position, combo)JuiceBurst.Spawn(position, gold, 6, 3.5f, 0.12f, 0.3f), JuiceSfx.PlayCombo(coinSound, combo, 0.45f)
Juice.Explode(position, power)HitStop(0.12f * power), Add(0.6f * power), JuiceShake.Zoom(0.04f * power, 0.3f), JuiceBurst.Explosion(position, null, power), Blip(Explosion, 0.6f)
Juice.Win(position)JuiceBurst.Confetti(position), Blip(PowerUp), JuiceTime.SlowMo(0.4f, 0.4f), JuiceShake.Zoom(0.06f, 0.5f)
Juice.Lose()Blip(Lose), JuiceTime.SlowMo(0.3f, 0.6f), JuiceShake.Add(0.5f)

If the user wants something different (e.g., shorter hit stop, no shake), replace the recipe line with the individual lines from the table, then adjust numbers or remove lines.

Two Must-Know Things

  1. Transformations only apply to safe objects. JuiceSquash.Squash, Stretch, Punch (and the recipes Juice.Jump, Land, Hit, Hurt that use them) automatically choose the target:
    • If the character's graphics are on a child object: only that child object is transformed; the collider is unaffected.
    • If graphics and a "gravity-affected rigidbody" (Dynamic Rigidbody or CharacterController) are on the same object: no transformation is performed, a one-time Console warning is logged, and other feedback runs normally. Scaling such an object would move the collider and ground detection points, causing the character to float or repeatedly trigger landing.
    • In the second case: if you can edit the scene, move the graphic (Sprite or model) to a child object; otherwise, tell the user in your response to do so for squash and stretch to work.
  2. Juice.Hit, Hurt, Explode, Win, Lose modify Time.timeScale (hit stop or slow motion). If the project has a pause menu, add JuiceTime.Cancel(); before entering pause; see juice-hit-stop for details.

Demo Scene

  • Human: Menu Tools ▸ Juice ▸ Create Demo Scene, press Play, then toggle feedback on/off with the switches on the left.
  • AI Agent: Call JuiceMenu.AddDemoToScene(); (no dialog), then enter Play mode.

Accessibility

Some players experience discomfort from screen shake or flashing. Juice Kit includes three built-in settings that auto-save:

JuiceSettings.ScreenShake = false;  // Turns off shake, recoil, zoom
JuiceSettings.Flashes = false;      // Turns off white flashes
JuiceSettings.Intensity = 0.5f;     // Overall intensity 0–1

If the project has a settings menu, proactively suggest hooking these up.

Rules

  • To adjust feel, change the numbers passed at call time or fields in the Inspector—do not modify files inside Assets/Juice/; future Kit updates will overwrite everything.
  • Recommended Unity 2022.3+. Tested on Unity 6 (6000.5) URP and Built-In pipeline.

相关技能