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
Forwardclip 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 theSpritechild) picks the walk state from the angle to the camera. ItsanimStateslist 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.
FaceCameracachesCamera.mainonce, so the player camera must be taggedMainCameraand 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¶
- Import the PNGs with the settings above.
- Slice them in the Sprite Editor (Grid By Cell Size), same frame size, pivot at the feet.
- Create or edit the clips in the Animation window.
- Assign the clips in the enemy's override controller (for a new enemy, duplicate the prefab and the override).
- If the height changed, readjust the
EnemyUIheight, theBulletSpawnposition andoffsetInCells.
Animate first-person weapons¶
- Attacking plays
Shot(ranged) orAttack(melee and throwable) viaAnimator.Play. Idlein 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
VisualonMelee-HuntingKnife). - Put the muzzle flash at the profile's
ImpactNormalizedand keep it for a few frames; a single-frame flash can be skipped.
Make a simple sprite effect¶
- Add
SpriteRendererandSpriteSequenceAnimationto one object. - Fill
sprites(no gaps),intervalandspeedMultiplier(both > 0). - Turn
despawnWhenFinishedon to play once, off to loop. - If the effect is pooled, add
ReturnToPoolAfterwithlifetime = 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,MediumandHighpipeline assets inAssets/DungeonCrawler/Settings/, shown as Potato / Normal / Hell On PC (pt-BR: Batata / Normal / Inferno no PC). Rename them via keysQuality0toQuality2in theSettingstable. 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.