Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

PowerQuest

A Nifty 2D Adventure Toolkit for Unity · By Powerhoof

Getting 2d lighting with URP working in PowerQuest

A topic by Powerhoof created Nov 05, 2021 Views: 533 Replies: 1
Viewing posts 1 to 2
(+1)

A few people have been using unity's URP 2d lighting for their games, but PowerQuest doesn't work perfectly for it out of the box, since I'm not using it myself.

Really, the problem is just that characters use a custom shader to offset their sprite, and unity's shader doesn't do that. So here's a couple of ways around it-

Option 1: Use a custom shader

  • Download and install this shader from Joseph Riches of Robust Games
  • You'll need URP and ShaderGraph packages installed and it just goes on the Shader Override property on each Character
  • That's it!
  • Extras Notes from Joseph: The MainTex property has a reference for _MainTex and the Offset property has a reference for _Offset in the Node Settings which means they just pick up the Sprite from the SpriteRenderer and the Offset from the Sprite component (as far as I understand it). This is the graph:

Option 2:  Use the original unity shader, but move the character sprite to be nested under the character game object:

  • Open the character prefab
  • Make a child gameobject under the character
  • Add a "PowerSprite" and "Sprite Animation" component
  • Put the URP lit shader in the "shader override" field of the PowerSprite component
  • Remove the animator, and sprite components from the parent gameobject.
  • Then just move the transform of the child object so that the feet line up with the parent object's position.

Another note on this- To stop lights being disabled when the game is paused, you can either:

  • Put the lights in the NoPause layer
  • Or, Open the SystemTime prefab, find the Ignored Components list, and add the Light2D component