Skip to content

Sprites and animation

Characters, props, pickups and effects are billboard sprites in a 3D URP world.

Import sprite sheets

Each animation is a PNG with frames in a horizontal strip, one file per animation (_Idle, _WalkSouth, _WalkNorth, _WalkEast, _WalkWest, _Attack, _Hurt, _Death). Settings used by SkeletonArquebusier:

  • Sprite (2D and UI), Multiple, Filter Mode Point, no mipmaps, Clamp, no compression.
  • 180 × 180 px frames at 58.5 Pixels Per Unit (adjust to the character's height).
  • Custom pivot at the feet: (0.5, 0.133). The actor's pivot sits on the cell floor.

To keep new art at the same on-screen height, keep the frame size and PPU, or adjust the PPU or the Sprite child's scale.

Animate enemies and NPCs

Enemies share Animation/Enemy/EnemyBase.controller. Each enemy has an Animator Override Controller that only swaps clips. States: Idle, Forward, Backward, Left, Right (walking), Attack, Hurt, Death (the last frame stays as a corpse if leaveCorpse), plus optional ChargeStart, ChargeLoop, ChargedAttack for charged attacks.

State names are a contract

Don't rename them.

  • Front-only art? Use the Forward clip for all four walk states.
  • Walk pace lives in the clip itself (about two steps in 0.5 s); an override can't change state speed.
  • DirectionalSpriteRenderer (on the Sprite child) picks the walk state from the angle to the camera. Its animStates list has a fixed order, Forward, Backward, Right, Left, and the states must be on layer 0.
  • There is no automatic mirroring: draw the west walk as a mirrored east walk.
  • FaceCamera caches Camera.main once, so the player camera must be tagged MainCamera and exist when the scene starts.

The player camera sits 0.75 m above the floor with a 60° vertical FOV. Keep an enemy's head below about 2.1 m (with EnemySpriteOffset 0) and reduce offsetInCells for tall characters. See Create an enemy.

Replace an enemy's sprite

  1. Import the PNGs with the settings above.
  2. Slice them in the Sprite Editor (Grid By Cell Size), same frame size, pivot at the feet.
  3. Create or edit the clips in the Animation window.
  4. Assign the clips in the enemy's override controller (for a new enemy, duplicate the prefab and the override).
  5. If the height changed, readjust the EnemyUI height, the BulletSpawn position and offsetInCells.

Animate first-person weapons

  • Attacking plays Shot (ranged) or Attack (melee and throwable) via Animator.Play.
  • Idle in the generic controllers runs at speed 0.5, so the cycle takes twice the clip length.
  • Don't animate the weapon root. Animate a child (like Visual on Melee-HuntingKnife).
  • Put the muzzle flash at the profile's ImpactNormalized and keep it for a few frames; a single-frame flash can be skipped.

Make a simple sprite effect

  1. Add SpriteRenderer and SpriteSequenceAnimation to one object.
  2. Fill sprites (no gaps), interval and speedMultiplier (both > 0).
  3. Turn despawnWhenFinished on to play once, off to loop.
  4. If the effect is pooled, add ReturnToPoolAfter with lifetime = 0.

Example: Prefabs/FX/Bloods/FX_Blood_01.prefab. Animator-based effects use DestroyAfterAnimation, which destroys the object; don't use it with pooling. Blood or bone-dust effects are chosen in the EnemyEntity Hurt Settings.

Lighting and rendering

  • Quality levels use the Low, Medium and High pipeline assets in Assets/DungeonCrawler/Settings/, shown as Potato / Normal / Hell On PC (pt-BR: Batata / Normal / Inferno no PC). Rename them via keys Quality0 to Quality2 in the Settings table.
  • Low (Potato) targets weak machines and WebGL on integrated GPUs: no shadows, no HDR, render scale 0.75.
  • Don't add Motion Blur to the base post-processing profile.
  • URP applies at most 8 additional lights per object: avoid many point lights in one room.

Sprites receive no light or shadow

The sample levels compensate: wall shadows are off in the starting rooms, and the boss arena is bright because the boss is dark. Ambient is Trilight with a stronger Ground color (it lights the ceiling) and a Directional Light at about 0.6.

Gamma color space

The project uses Gamma. In Linear, the environment changes but unlit sprites barely do, so you'll need to rebalance them.

For internals, see Assets/DungeonCrawler/Scripts/Animation/ARCHITECTURE.md.