Mouse over highlight with multiple colliders
Hello. I'm having a bit of a problem in my top down game with overlapping colliders and wondering the best way to fix it. Basically when I hover over an npc, I would like a little pop-up to appear over their heads. My current approach works okay, but it's very touchy because the npcs have multiple colliders and I only want the pop-up to appear when the hotbox collider is hovered. Often it will close the pop-up even while the hotbox collider is still hovered and I suspect the reason is another collider is overlapping and getting in the way. Is there a best way to handle this? I've heard layer masks might help, but that requires a new child gameobject for every collider, right?
https://redd.it/1goxvh5
@r_Unity3D
Hello. I'm having a bit of a problem in my top down game with overlapping colliders and wondering the best way to fix it. Basically when I hover over an npc, I would like a little pop-up to appear over their heads. My current approach works okay, but it's very touchy because the npcs have multiple colliders and I only want the pop-up to appear when the hotbox collider is hovered. Often it will close the pop-up even while the hotbox collider is still hovered and I suspect the reason is another collider is overlapping and getting in the way. Is there a best way to handle this? I've heard layer masks might help, but that requires a new child gameobject for every collider, right?
https://redd.it/1goxvh5
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
Please help me. I try to get the New InputSystem to work but i cant figure this out.
https://redd.it/1gp019c
@r_Unity3D
https://redd.it/1gp019c
@r_Unity3D
How to create Character-Specific Shop System?
I have six characters in my game, and I want to set up a shop system where players can buy and equip character-specific skins. Each character has their own designated skins that only the intended character can use.
I tried using ScriptableObjects for managing these skins, but I’m having issues. Every time I exit the shop scene, the equipped skins sometimes unequip themselves. I'm using player pref btw, in case it helps to shine more light on this problem. My issue while creating shop system right now is I don't know a proper way to carry persistent game data between scene
Is there a better solution for managing character-specific skins, or is using ScriptableObjects a bad approach for this?
https://redd.it/1gozqp7
@r_Unity3D
I have six characters in my game, and I want to set up a shop system where players can buy and equip character-specific skins. Each character has their own designated skins that only the intended character can use.
I tried using ScriptableObjects for managing these skins, but I’m having issues. Every time I exit the shop scene, the equipped skins sometimes unequip themselves. I'm using player pref btw, in case it helps to shine more light on this problem. My issue while creating shop system right now is I don't know a proper way to carry persistent game data between scene
Is there a better solution for managing character-specific skins, or is using ScriptableObjects a bad approach for this?
https://redd.it/1gozqp7
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
Selecting tile at camera/player position when it's supposed to be at mouse position
I'm trying to follow this tutorial to be able to add a building system to my game, which I can then modify afterwords into a farming system. So far, even with them skipping over some steps, I've been able to implement things fine, but when trying to make it highlight a tile at the position of my mouse, it instead highlights the one at the position of my camera, and therefor the player, and I can't figure out how to fix it.
tillingSoil:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class tillingSoil : MonoBehaviour
{
SerializeField private item item;
SerializeField private TileBase highlightTile;
SerializeField private Tilemap mainTilemap;
SerializeField private Tilemap tempTilemap;
private Vector3Int highlightedTilePos;
private bool highlighted;
private void Update()
{
if(item != null)
{
HighlightTile(item);
}
}
private Vector3Int GetMouseOnGridPos()
{
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3Int mouseCellPos = mainTilemap.WorldToCell(mousePos);
mouseCellPos.z = 0;
return mouseCellPos;
}
private void HighlightTile(item currentItem)
{
Vector3Int mouseGridPos = GetMouseOnGridPos();
if(highlightedTilePos != mouseGridPos)
{
tempTilemap.SetTile(highlightedTilePos, null);
TileBase tile = mainTilemap.GetTile(mouseGridPos);
if(tile)
{
tempTilemap.SetTile(mouseGridPos, highlightTile);
highlightedTilePos = mouseGridPos;
highlighted = true;
}
else
{
highlighted = false;
}
}
}
}
This\^ noscript is attached to my player (current highlight tile is a place holder)
https://preview.redd.it/ae7s12xuub0e1.png?width=448&format=png&auto=webp&s=960858a243671310e3b0cb268127d10a96be187c
Video to show what's currently happening: https://www.reddit.com/user/LilGrade21/comments/1gp26ij/\_/
https://redd.it/1gp275j
@r_Unity3D
I'm trying to follow this tutorial to be able to add a building system to my game, which I can then modify afterwords into a farming system. So far, even with them skipping over some steps, I've been able to implement things fine, but when trying to make it highlight a tile at the position of my mouse, it instead highlights the one at the position of my camera, and therefor the player, and I can't figure out how to fix it.
tillingSoil:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class tillingSoil : MonoBehaviour
{
SerializeField private item item;
SerializeField private TileBase highlightTile;
SerializeField private Tilemap mainTilemap;
SerializeField private Tilemap tempTilemap;
private Vector3Int highlightedTilePos;
private bool highlighted;
private void Update()
{
if(item != null)
{
HighlightTile(item);
}
}
private Vector3Int GetMouseOnGridPos()
{
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3Int mouseCellPos = mainTilemap.WorldToCell(mousePos);
mouseCellPos.z = 0;
return mouseCellPos;
}
private void HighlightTile(item currentItem)
{
Vector3Int mouseGridPos = GetMouseOnGridPos();
if(highlightedTilePos != mouseGridPos)
{
tempTilemap.SetTile(highlightedTilePos, null);
TileBase tile = mainTilemap.GetTile(mouseGridPos);
if(tile)
{
tempTilemap.SetTile(mouseGridPos, highlightTile);
highlightedTilePos = mouseGridPos;
highlighted = true;
}
else
{
highlighted = false;
}
}
}
}
This\^ noscript is attached to my player (current highlight tile is a place holder)
https://preview.redd.it/ae7s12xuub0e1.png?width=448&format=png&auto=webp&s=960858a243671310e3b0cb268127d10a96be187c
Video to show what's currently happening: https://www.reddit.com/user/LilGrade21/comments/1gp26ij/\_/
https://redd.it/1gp275j
@r_Unity3D
YouTube
2D Grid Building System - Unity Tutorial | Point & Click, Loot Drop & Collect
An easy point & click building system like in Terraria! With breaking blocks, dropping loot, and collecting the resources. Bonus: an inventory system!
➡️@CocoCode Inventory system video - https://youtu.be/oJAE6CbsQQA
Get the project files - https://www.…
➡️@CocoCode Inventory system video - https://youtu.be/oJAE6CbsQQA
Get the project files - https://www.…
Rate my game 1-10 and tell me what I should change(I'm a new programmer)
game : https://totoriel.itch.io/solarsandbox
https://redd.it/1gp4ea3
@r_Unity3D
game : https://totoriel.itch.io/solarsandbox
https://redd.it/1gp4ea3
@r_Unity3D
itch.io
Solar Sandbox by totoriel
Physics Sandbox Simulation. Play in your browser
Need help with my character collider.
u/Expensive_News22 helped me fixing this, thanks alot. Had to adjust a few settings in the Layer Collision Matrix. Thanks!
Hey everyone! This is my first post here. I’m a complete beginner with no experience in Unity and just a bit in C#. For my university project, I’m making a 2D platformer game. I have platforms, and the player needs to be able to jump on top of each one, which works fine. But here’s the problem:
* When I use a polygon collider, the player’s head or body keeps getting stuck against walls or platforms, preventing movement.
[Character gets stuck when colliding with the wall or platform. \(In this case, the character actually mini-jumps in place upon collision because I am using a slippery material.\) Red = the collider that is getting stuck on the platform. Yellow marked area is the feet collider, which is not a problem, since it \\"slides\\" from the platform because of the Slip material. \(this is not the polygon collider, but same concept with that one\)](https://preview.redd.it/qj4iojdngb0e1.png?width=336&format=png&auto=webp&s=a61fc18eb441b956b9274d69daa6ea7301e4eb20)
I tried to fix this by limiting the collider to just the player’s feet, and it worked! Now, instead of getting stuck or glitching against walls or platforms, the player just keeps walking. Sounds like it’s fixed, right? But there’s another issue.
[Edited the polygon collider so the body doesn't collide with the wall or platform.](https://preview.redd.it/of2zwiypdb0e1.png?width=343&format=png&auto=webp&s=d5ebec5b1ab5586ac72a6e9f7ba3cce0e5bfe06b)
I also have obstacles (like a spinning saw) that the player needs to crouch to avoid. To make this work, I wanted to animate the collider to match the crouch animation, but I learned you can’t animate polygon colliders—only box or circle colliders for example. So, I created a circle and capsule collider instead and adjusted them for crouching. This solved the issue with the obstacle touching the character correctly.
[Using different colliders to achieve a working crouch collider.](https://preview.redd.it/vd4tg4f2fb0e1.png?width=490&format=png&auto=webp&s=9a94b0f023ebebeb345199fdd22c4890201b3e9d)
[Crouch collider](https://preview.redd.it/hwbose4rfb0e1.png?width=367&format=png&auto=webp&s=f0ae2f70535fb0d2349f635f815927282c685cc0)
But now I’m back to square one: the player is getting stuck on walls and platforms again.
Here’s what I need help with:
1. Ensuring the player has a ground check collider just at their feet (not sure if this is the best way).
2. Preventing the player’s body and head from getting stuck on walls or platforms.
3. Making sure the player can still be hit by obstacles.
4. Ensuring the player isn’t hit when crouching (using a different collider for crouching).
As I mentioned, I’m totally new to this and unsure if my approach is correct. I’ve searched everywhere YouTube, Reddit, Google, and even ChatGPT but I can’t seem to solve this. I’d really appreciate any guidance. Thanks a lot.
https://redd.it/1gozg08
@r_Unity3D
u/Expensive_News22 helped me fixing this, thanks alot. Had to adjust a few settings in the Layer Collision Matrix. Thanks!
Hey everyone! This is my first post here. I’m a complete beginner with no experience in Unity and just a bit in C#. For my university project, I’m making a 2D platformer game. I have platforms, and the player needs to be able to jump on top of each one, which works fine. But here’s the problem:
* When I use a polygon collider, the player’s head or body keeps getting stuck against walls or platforms, preventing movement.
[Character gets stuck when colliding with the wall or platform. \(In this case, the character actually mini-jumps in place upon collision because I am using a slippery material.\) Red = the collider that is getting stuck on the platform. Yellow marked area is the feet collider, which is not a problem, since it \\"slides\\" from the platform because of the Slip material. \(this is not the polygon collider, but same concept with that one\)](https://preview.redd.it/qj4iojdngb0e1.png?width=336&format=png&auto=webp&s=a61fc18eb441b956b9274d69daa6ea7301e4eb20)
I tried to fix this by limiting the collider to just the player’s feet, and it worked! Now, instead of getting stuck or glitching against walls or platforms, the player just keeps walking. Sounds like it’s fixed, right? But there’s another issue.
[Edited the polygon collider so the body doesn't collide with the wall or platform.](https://preview.redd.it/of2zwiypdb0e1.png?width=343&format=png&auto=webp&s=d5ebec5b1ab5586ac72a6e9f7ba3cce0e5bfe06b)
I also have obstacles (like a spinning saw) that the player needs to crouch to avoid. To make this work, I wanted to animate the collider to match the crouch animation, but I learned you can’t animate polygon colliders—only box or circle colliders for example. So, I created a circle and capsule collider instead and adjusted them for crouching. This solved the issue with the obstacle touching the character correctly.
[Using different colliders to achieve a working crouch collider.](https://preview.redd.it/vd4tg4f2fb0e1.png?width=490&format=png&auto=webp&s=9a94b0f023ebebeb345199fdd22c4890201b3e9d)
[Crouch collider](https://preview.redd.it/hwbose4rfb0e1.png?width=367&format=png&auto=webp&s=f0ae2f70535fb0d2349f635f815927282c685cc0)
But now I’m back to square one: the player is getting stuck on walls and platforms again.
Here’s what I need help with:
1. Ensuring the player has a ground check collider just at their feet (not sure if this is the best way).
2. Preventing the player’s body and head from getting stuck on walls or platforms.
3. Making sure the player can still be hit by obstacles.
4. Ensuring the player isn’t hit when crouching (using a different collider for crouching).
As I mentioned, I’m totally new to this and unsure if my approach is correct. I’ve searched everywhere YouTube, Reddit, Google, and even ChatGPT but I can’t seem to solve this. I’d really appreciate any guidance. Thanks a lot.
https://redd.it/1gozg08
@r_Unity3D
Hi guys! I created a devlog about the game that I'm working on. I hope you will like it :)
https://youtu.be/C4mm9L7b2ek
https://redd.it/1gp7rn1
@r_Unity3D
https://youtu.be/C4mm9L7b2ek
https://redd.it/1gp7rn1
@r_Unity3D
YouTube
My Pokémon Duel-Inspired Game! | Tamigo Spin! Devlog #1
Introducing Tamigo Spin! 🎉 In this devlog series, we’ll be taking you behind the scenes as we develop our new spin-based battle game, inspired by the strategic gameplay of Pokémon Duel but with a fresh twist. In Episode 1, dive into the world of Tamigo Spin!…
Need Help with Tile Rule Configuration in Unity 2D - Missing Corners Issue!
Hey everyone,
I'm working on a Unity 2D project and running into an issue with my Tile Rules. I'm really close to getting it right, but the configuration is getting a bit overwhelming!
As you can see in the pictures, I can't seem to get certain corners to fill properly. I'm not sure if it's the exterior or interior corners that are missing, but either way, I'm not getting the result I need. I have all the necessary tiles, but I’m struggling with how to set it up in the Inspector to make everything work.
If anyone can guide me through the configuration steps or provide tips on setting up Tile Rules to handle these corners, that would be super helpful!
Thanks in advance!
https://preview.redd.it/bydhamhowd0e1.png?width=876&format=png&auto=webp&s=871ae6d309e08e61e7ee27c66766786702dc9a37
https://preview.redd.it/g2o3mg4pwd0e1.png?width=279&format=png&auto=webp&s=dc00b88f882e20aa72058d885d2254ee50087b5e
https://preview.redd.it/10vuuzkpwd0e1.png?width=272&format=png&auto=webp&s=803f353b71d0641c91dfac43b6645c2144010445
https://redd.it/1gpar5s
@r_Unity3D
Hey everyone,
I'm working on a Unity 2D project and running into an issue with my Tile Rules. I'm really close to getting it right, but the configuration is getting a bit overwhelming!
As you can see in the pictures, I can't seem to get certain corners to fill properly. I'm not sure if it's the exterior or interior corners that are missing, but either way, I'm not getting the result I need. I have all the necessary tiles, but I’m struggling with how to set it up in the Inspector to make everything work.
If anyone can guide me through the configuration steps or provide tips on setting up Tile Rules to handle these corners, that would be super helpful!
Thanks in advance!
https://preview.redd.it/bydhamhowd0e1.png?width=876&format=png&auto=webp&s=871ae6d309e08e61e7ee27c66766786702dc9a37
https://preview.redd.it/g2o3mg4pwd0e1.png?width=279&format=png&auto=webp&s=dc00b88f882e20aa72058d885d2254ee50087b5e
https://preview.redd.it/10vuuzkpwd0e1.png?width=272&format=png&auto=webp&s=803f353b71d0641c91dfac43b6645c2144010445
https://redd.it/1gpar5s
@r_Unity3D
Unity Shader not rendering in game
I made a fog shader for my game for this little sewer level using shader graph, but the shader is not being rendered by the camera. All nodes are marked as exposed. I do not have URP installed because when I tried to install it, it came with multiple errors and was presumably missing files, so that option is not possible at the moment unless someone happens to know the solution. Any help would be much appreciated. Thanks in advance.
https://preview.redd.it/okqhc5gqoe0e1.png?width=838&format=png&auto=webp&s=8c68bcb16463305ba83e92a429fc82a4feeac1a8
https://redd.it/1gpdlby
@r_Unity3D
I made a fog shader for my game for this little sewer level using shader graph, but the shader is not being rendered by the camera. All nodes are marked as exposed. I do not have URP installed because when I tried to install it, it came with multiple errors and was presumably missing files, so that option is not possible at the moment unless someone happens to know the solution. Any help would be much appreciated. Thanks in advance.
https://preview.redd.it/okqhc5gqoe0e1.png?width=838&format=png&auto=webp&s=8c68bcb16463305ba83e92a429fc82a4feeac1a8
https://redd.it/1gpdlby
@r_Unity3D
Need advice: Designing intuitive spear-throwing controls for a platformer (controller)
I'm developing my first game, a platformer (obviously :) ) where the core mechanic is throwing a spear, which also provides momentum to the player in the opposite direction (think reverse rocket jump). I'm struggling with making the controls feel smooth and intuitive on a controller.
Current thoughts/challenges:
* Left stick is used for movement, so using it for aim would conflict with the platforming and player's movement
* Right stick seems like the obvious choice for aiming, but I'm concerned it might feel clunky since players need to use this mechanic frequently
* The mechanic needs to feel fluid since it's core to both combat and traversal
Questions:
1. Has anyone implemented similar directional mechanics that worked well with a controller?
2. Are there any games with similar mechanics I should study?
3. What button/stick combination would feel most natural to players?
Any suggestions or examples would be greatly appreciated!
https://redd.it/1gpgga9
@r_Unity3D
I'm developing my first game, a platformer (obviously :) ) where the core mechanic is throwing a spear, which also provides momentum to the player in the opposite direction (think reverse rocket jump). I'm struggling with making the controls feel smooth and intuitive on a controller.
Current thoughts/challenges:
* Left stick is used for movement, so using it for aim would conflict with the platforming and player's movement
* Right stick seems like the obvious choice for aiming, but I'm concerned it might feel clunky since players need to use this mechanic frequently
* The mechanic needs to feel fluid since it's core to both combat and traversal
Questions:
1. Has anyone implemented similar directional mechanics that worked well with a controller?
2. Are there any games with similar mechanics I should study?
3. What button/stick combination would feel most natural to players?
Any suggestions or examples would be greatly appreciated!
https://redd.it/1gpgga9
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
How do you achieve Celeste-levels of collision accuracy in Unity?
Celeste has "pixel perfect" collisions and triggers that update one "pixel" at a time, while Unity seemingly updates in "chunks" despite both being set to 60 updates a second.
In this screenshot the character is dashing forward at top speed and will be one "pixel" inside the red trigger on the next frame, making contact. In Unity the character hitbox would be outside one update, then halfway inside the next. What do I change about my project to make interacting with objects as precise as this?
https://redd.it/1gph4ef
@r_Unity3D
Celeste has "pixel perfect" collisions and triggers that update one "pixel" at a time, while Unity seemingly updates in "chunks" despite both being set to 60 updates a second.
In this screenshot the character is dashing forward at top speed and will be one "pixel" inside the red trigger on the next frame, making contact. In Unity the character hitbox would be outside one update, then halfway inside the next. What do I change about my project to make interacting with objects as precise as this?
https://redd.it/1gph4ef
@r_Unity3D
Imgur
Discover the magic of the internet at Imgur, a community powered entertainment destination. Lift your spirits with funny jokes, trending memes, entertaining gifs, inspiring stories, viral videos, and so much more from users.
AHH NEED HELP ! how can I shorten this period (Compiling)? What precautions should be taken?
https://redd.it/1gpgv1b
@r_Unity3D
https://redd.it/1gpgv1b
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
The only way to get crafting resources in the game Effulgence is by taking down the inhabitants and breaking them into particles. Trying to figure out how this might look. Looks good?
https://redd.it/1gpjvlr
@r_Unity3D
https://redd.it/1gpjvlr
@r_Unity3D
Any idea on how to solve this? My pixel perfect camera is doing this (image below) even though my original sprite looks like above, I tried changing the pixels per unit in the original image, the pixels per unit in the camera, etc. (its an IU image if that's relevant)
https://redd.it/1gpksap
@r_Unity3D
https://redd.it/1gpksap
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
Finished up adding various UI themes to my Unity desktop companion game.
https://redd.it/1gpj6ac
@r_Unity3D
https://redd.it/1gpj6ac
@r_Unity3D
2D glow problem
Hello this is my first game and I'm trying to make my attack glow, I tried multiple tutorial on youtube but nothing work. The tutorial : https://www.youtube.com/watch?v=Tm0rRX8GnFk&t=71s, https://www.youtube.com/watch?v=WiDVoj5VQ4c&t=852s and https://www.youtube.com/watch?v=G1x-NA05CeA, sry if this is a stupid question
https://preview.redd.it/pqkxw201nh0e1.png?width=1170&format=png&auto=webp&s=36ca29443f0fa362cb04976ef99de7a34e31174d
https://preview.redd.it/28rxyv68nh0e1.png?width=4800&format=png&auto=webp&s=b153d05313da91999a0339082d863b8164297cc1
https://preview.redd.it/vqeoev68nh0e1.png?width=4800&format=png&auto=webp&s=d651018931763fad9fccbd99b60f44ec5ccb0ac7
https://redd.it/1gpn5fn
@r_Unity3D
Hello this is my first game and I'm trying to make my attack glow, I tried multiple tutorial on youtube but nothing work. The tutorial : https://www.youtube.com/watch?v=Tm0rRX8GnFk&t=71s, https://www.youtube.com/watch?v=WiDVoj5VQ4c&t=852s and https://www.youtube.com/watch?v=G1x-NA05CeA, sry if this is a stupid question
https://preview.redd.it/pqkxw201nh0e1.png?width=1170&format=png&auto=webp&s=36ca29443f0fa362cb04976ef99de7a34e31174d
https://preview.redd.it/28rxyv68nh0e1.png?width=4800&format=png&auto=webp&s=b153d05313da91999a0339082d863b8164297cc1
https://preview.redd.it/vqeoev68nh0e1.png?width=4800&format=png&auto=webp&s=d651018931763fad9fccbd99b60f44ec5ccb0ac7
https://redd.it/1gpn5fn
@r_Unity3D
YouTube
Unity 2D Glow Tutorial
Let's see how to add a quick 2D Glow to your game! This time we have a 2D Tutorial and we are in the 2D Renderer of URP and we will use Shader Graph! Enjoy!
***Follow Rabbit's Tale game development***
Twitter: https://twitter.com/GoldenBugStudio
TikTok:…
***Follow Rabbit's Tale game development***
Twitter: https://twitter.com/GoldenBugStudio
TikTok:…