News about the Unity engine and project showcases from Reddit. Made possible with @reddit2telegram (@r_channels).
My Lit Shader Seems To Be Unlit In Unity
Shader "Custom/ProtectedEnemyOutline"
{
Properties
{
[MainTexture]_MainTex("Sprite Texture", 2D) = "white" {}
[MainColor]_Color("Tint", Color) = (1, 1, 1, 1)
_OutlineColor("Outline Color", Color) = (0, 1, 1, 1)
_Thickness("Outline Thickness", Range(0.0, 10.0)) = 1.0
}
SubShader
{
Tags {
"RenderType"="Transparent"
"Queue"="Transparent"
"IgnoreProjector"="True"
"PreviewType"="Sprite"
"CanUseSpriteAtlas"="True"
}
Pass
{
Name "Lit"
Tags { "LightMode"="Universal2D" }
Blend SrcAlpha OneMinusSrcAlpha
Cull Off
ZWrite Off
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl"
struct Attributes
{
float4 position : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};
struct Varyings
{
float4 position : SV_POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
float4 _MainTex_TexelSize;
float4 _Color;
float4 _OutlineColor;
float _Thickness;
TEXTURE2D(_ShapeLightTexture0);
SAMPLER(sampler_ShapeLightTexture0);
TEXTURE2D(_ShapeLightTexture1);
SAMPLER(sampler_ShapeLightTexture1);
TEXTURE2D(_ShapeLightTexture2);
SAMPLER(sampler_ShapeLightTexture2);
TEXTURE2D(_ShapeLightTexture3);
SAMPLER(sampler_ShapeLightTexture3);
Varyings vert(Attributes IN)
{
Varyings OUT;
OUT.position = TransformObjectToHClip(IN.position.xyz);
OUT.uv = IN.uv;
OUT.color = IN.color * _Color;
return OUT;
}
float4 SampleSpriteLighting(float2 uv)
{
#ifdef USE_SHAPE_LIGHT_TYPE_0
float4 light0 = SAMPLE_TEXTURE2D(_ShapeLightTexture0, sampler_ShapeLightTexture0, uv);
#else
float4 light0 = float4(1,1,1,1);
#endif
#ifdef USE_SHAPE_LIGHT_TYPE_1
float4 light1 = SAMPLE_TEXTURE2D(_ShapeLightTexture1, sampler_ShapeLightTexture1, uv);
#else
float4 light1 = float4(0,0,0,0);
#endif
#ifdef USE_SHAPE_LIGHT_TYPE_2
float4 light2 = SAMPLE_TEXTURE2D(_ShapeLightTexture2, sampler_ShapeLightTexture2, uv);
#else
float4 light2 = float4(0,0,0,0);
#endif
#ifdef USE_SHAPE_LIGHT_TYPE_3
float4 light3 = SAMPLE_TEXTURE2D(_ShapeLightTexture3, sampler_ShapeLightTexture3, uv);
#else
float4 light3 = float4(0,0,0,0);
#endif
return light0 + light1 + light2 + light3;
}
half4 frag(Varyings IN) : SV_Target
{
float4 tex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, IN.uv) * IN.color;
What do u think abt this boss battle I'm working on??
https://redd.it/1m659re
@r_Unity3D
Why is my game not recording collisions? (ignore the stupid sprite)
https://redd.it/1m63v6n
@r_Unity3D
curious how you’d achieve this ground fog effect?
https://redd.it/1m5qyel
@r_Unity3D
This is my first game, made using ECS and no prior unity experience, did this for an intership
https://redd.it/1m5kkd1
@r_Unity3D
Our wannabe-professional indie trailer is out! Be gentle (or roast us, your call):)
https://redd.it/1m5l00i
@r_Unity3D
OKLab quantization/dither filter, here's a showcase of me using it for 1bit graphics.
https://redd.it/1m52huf
@r_Unity3D
Anyone know how to create impact frames?
https://redd.it/1m4s7zf
@r_Unity3D
I added god rays to improve the atmosphere. Do you like?
https://redd.it/1m4v7sg
@r_Unity3D
Made Glitch Shader in the Graph. How do I implement it as a hit feedback to the sprite (for game feel)?
I have no idea about shader graph so I followed some online forums to make a Flicker and noise effect with the URP Shader Graph. I want this shader effect to trigger any time the player click on a sprite.
How do I add the functionality to the 2d Sprite?
https://redd.it/1m4wizs
@r_Unity3D
QUESTIONS
hey how can ı set the map another png(ı use maps as png not tilemaps and ı add colliders)ı will have a breakable object like stones when ı break it i would like to set the map another png how can ı do that also my maps shown in different scales i think ı didnt understand that my character's scale changes in different scenes
https://redd.it/1m4rpha
@r_Unity3D
My mobile (Android) game is finally playable!
https://redd.it/1m4q7wm
@r_Unity3D
Unexpected consequence of a Skill Tree unlock. Ha
https://redd.it/1m4kbwg
@r_Unity3D
Unity Streaming Environment - was bored the last few days
https://redd.it/1m4jxij
@r_Unity3D
My Lit Shader Seems To Be Unlit In Unity
Shader "Custom/ProtectedEnemyOutline"
{
Properties
{
MainTextureMainTex("Sprite Texture", 2D) = "white" {}
[MainColor]Color("Tint", Color) = (1, 1, 1, 1)
OutlineColor("Outline Color", Color) = (0, 1, 1, 1)
Thickness("Outline Thickness", Range(0.0, 10.0)) = 1.0
}
SubShader
{
Tags {
"RenderType"="Transparent"
"Queue"="Transparent"
"IgnoreProjector"="True"
"PreviewType"="Sprite"
"CanUseSpriteAtlas"="True"
}
Pass
{
Name "Lit"
Tags { "LightMode"="Universal2D" }
Blend SrcAlpha OneMinusSrcAlpha
Cull Off
ZWrite Off
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl"
struct Attributes
{
float4 position : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};
struct Varyings
{
float4 position : SVPOSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};
TEXTURE2D(MainTex);
SAMPLER(samplerMainTex);
float4 MainTexTexelSize;
float4 Color;
float4 OutlineColor;
float Thickness;
TEXTURE2D(ShapeLightTexture0);
SAMPLER(samplerShapeLightTexture0);
TEXTURE2D(ShapeLightTexture1);
SAMPLER(samplerShapeLightTexture1);
TEXTURE2D(ShapeLightTexture2);
SAMPLER(samplerShapeLightTexture2);
TEXTURE2D(ShapeLightTexture3);
SAMPLER(samplerShapeLightTexture3);
Varyings vert(Attributes IN)
{
Varyings OUT;
OUT.position = TransformObjectToHClip(IN.position.xyz);
OUT.uv = IN.uv;
OUT.color = IN.color _Color;
return OUT;
}
float4 SampleSpriteLighting(float2 uv)
{
#ifdef USE_SHAPE_LIGHT_TYPE_0
float4 light0 = SAMPLE_TEXTURE2D(_ShapeLightTexture0, sampler_ShapeLightTexture0, uv);
#else
float4 light0 = float4(1,1,1,1);
#endif
#ifdef USE_SHAPE_LIGHT_TYPE_1
float4 light1 = SAMPLE_TEXTURE2D(_ShapeLightTexture1, sampler_ShapeLightTexture1, uv);
#else
float4 light1 = float4(0,0,0,0);
#endif
#ifdef USE_SHAPE_LIGHT_TYPE_2
float4 light2 = SAMPLE_TEXTURE2D(_ShapeLightTexture2, sampler_ShapeLightTexture2, uv);
#else
float4 light2 = float4(0,0,0,0);
#endif
#ifdef USE_SHAPE_LIGHT_TYPE_3
float4 light3 = SAMPLE_TEXTURE2D(_ShapeLightTexture3, sampler_ShapeLightTexture3, uv);
#else
float4 light3 = float4(0,0,0,0);
#endif
return light0 + light1 + light2 + light3;
}
half4 frag(Varyings IN) : SV_Target
{
float4 tex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, IN.uv) IN.color;
Seamless transitions up and downstairs in 2D games?
Hey, I'm developing a 2D online game with a friend, and I wanted to ask how moving up staircases between floors could be done without having to throw in a loading screen.
Would simply teleporting the player to the upper floor work? Or would that too require a loading screen?
https://redd.it/1m63tl0
@r_Unity3D
I Upgrade to Unity 6 (from Unity 2021); and now a large number of my sprites contain artifacts/stuff that isn't in the original .png! What's going on?
https://redd.it/1m5thz7
@r_Unity3D
Miami Hotel Simulator, the game we've been working on for 3.5 years, will be released this week! What are your thoughts?
https://redd.it/1m5qtjj
@r_Unity3D
Solo indie horror made in Unity — feedback & tips welcome! (The Silent Jungle)
https://redd.it/1m5oc6n
@r_Unity3D
Introducing: The all-important, ultra-efficient kitty delivery system! 🐱 Every good cat wants one
https://redd.it/1m55r72
@r_Unity3D
how to fix shadow caster 2d in unity 6 urp looking really bad with pixel perfect camera
https://redd.it/1m54pe2
@r_Unity3D
Hey everyone I was making a 2D pixel game and now I am stuck in one :
I have a character with a hat. The hat is a separate sprite that I placed above the character using a "hatAnchor" GameObject (empty object as a child of the player). I set the hat’s sorting order to be above the body so it's always visible.
I made a jump animation (sprite sheet with 8 frames), and it plays fine. The character jumps with Rigidbody2D and the animation is synced properly.
BUT — the problem is when the jump animation plays, the hat doesn’t stay fixed to the head. It kind of moves weirdly or falls slightly, and for a moment the character’s head is visible underneath. It looks broken.
Here’s what I’ve done:
Made the hat a child of the "hatAnchor" GameObject
HatAnchor is placed where the head is (as a child of the player)
Sorting layer is set above the body
Didn’t animate the hat separately
Question: Why is the hat not staying in place during the animation?
Do I need to animate the hat separately for every animation? Or is there a better way to keep it fixed to the head?
https://redd.it/1m4w8nk
@r_Unity3D
This good boy wishes you a great week!
https://www.reddit.com/gallery/1m4x46q
https://redd.it/1m4xorr
@r_Unity3D
I Make Steam Capsule Art That Pops! DM me if interested
https://redd.it/1m4utmk
@r_Unity3D
Making a card game in Unity, any suggestions or critiques helps!
Yellow, I'm starting a Youtube series about making a card game in Unity, and currently its basically just a rip off of Slay the Spire, like literally im stealing assets 😘 , and considering they're already making the 2nd one, theres no need for a 3rd. Any critiques of the game help a lot. Except the art, im still like on day 2.3 of learning lol.
https://www.youtube.com/watch?v=cbSuzR2qgcA&t=325s&ab\_channel=NRyu
https://redd.it/1m4rwld
@r_Unity3D
People asking for help in this subreddit
https://redd.it/1m4p7rb
@r_Unity3D
How to Smoothly Rotate Player Body and Legs with Animation Sync in FPS Character?
https://redd.it/1m4kt04
@r_Unity3D
Wibbly-Wobbly Custom Shader
https://redd.it/1m4jxmb
@r_Unity3D