I have a 3D tile-based game in which players moves using buttons on screen…
The movements are very very predictive since the character only moves 1 unit every time ie. (walking, jumping)
I want to prohibit players from walking and jumping(forward) on ledges seen on the picture.
Any ideas? im willing to post my code if someone’s interested on helping me out… cheers

Maybe do a raycast from the current tile you are on towards the next tile (do it close to the ground). If you don’t know which tile you are on and only know the target tile, then do a raycast from near the players feet to the target tile. If you hit something (or maybe if you hit something with a tag of “Ledge”). This is assuming your ledge tile has a collider on it.
If you are not using colliders, then you can design your tile system in a way that each tile gets an enum TileType {Walkable, NotWalkable, etc…} and before you move to a tile, you check for its tile type. (this is probably the better way of doing things)
Yeah im using raycast right now to check whether the tile is “jumpable” like a platform you see on the 2nd picture.
What i want to happen is to fire an angular raycast so that it’ll check if it hits a tile, if the raycast returns true then it is “walkable” and when the raycast returns null then that means there are no tiles on the next position, so it is “notwalkable”
Im a little confused. Are you trying to find a solution to picture #1 or picture #2?
If it is picture #1, as in, you are trying to prevent players from walking off the edge, then Id assume there shouldnt be a problem since there wont be a collider to hit anyways.
If it is picture #2, than you said you are already using a raycast to detect if it is jumpable.
Are you saying you want to check if a tile is jumpable, and if so, do some kind of curved raycast to detect the next tile you will jump to?
A simpler way to handle this might be to use your cubes size in helping you find the tile next to it.
Something like “Physics.Raycast(jumpableCollider.position + ((Vector3.up * 10) + (movingDirection * tileWidth)))” The Vector3.up * 10 is just to move the raycast up over the tile.
If all your tiles are the same size then this might work
You can get your box colliders size with Unity - Scripting API: BoxCollider.size