Tile Based Map Screen - Help detecting a keyboard controlled Game Object on a Canvas

Not sure if this is the best place to post this, but here goes. So I’ve been trying to get a map screen working for my RPG and I’m sitting here scratching my head, so I was hoping someone could throw some ideas on how to accomplish what I’m trying to do since I’m sure it’s doable.
Here is what I want:

  • I want to open up with Map Screen (a Canvas) from my menu, which will be a square tile or hex tile image of the world (like what you might see in a roguelike or in a pen and paper RPG like D&D) Example 1 Example 2. This is easy enough, just putting an image on a canvas really.
  • I want to be able to move a Game Object (an image representing the player) on this screen with the keyboard arrow keys / wasd / numpad. This part isn’t too tough but I haven’t figured out how to make the movement grid based yet so some advice on that would be great.
  • Here’s the part I can’t figure out. Wherever the player icon is, I want to return information to the side of the screen about that tile. So each tile needs to hold info like what locations are there, and what scene / area to load if the player travels there.

I cannot figure #3 out. I think I could put together a world map with clickable icons that you mouse over and click on to go there (Witcher 3 style), but this tile based world map controlled by the keyboard I can’t get to work.

All of the UI functions that I can find that return info are related to the mouse and not to some Game Object.
I tried ray casting down from the player icon GameObject onto the map image but that only worked with colliders for each map tile, which seems a bit excessive.

I also considered that maybe instead of a UI element, when the map screen opens it should just switch to a top-down camera that is showing a different part of the scene where the map is, but I worry that would be really finicky with the scene lighting and such. My game has a day night cycle and is in 3D and switching to an orthographic camera over an image seems like the first step but I’m not sure how to deal with the lighting in particular.

Thanks in advance for any ideas on this!

TL;DR: I’m trying to build a grid-based world map movement system in the UI that is controlled primarily by the keyboard and returns information about each tile on the grid based on where the player icon is moved to.

Sounds like you’re trying to bite off all the problems at once: player movement, world definition, lighting, camera angling, etc.

Slow down and back up to engineer one piece at a time: break out a piece of graph paper and define a 10x10 space as your “world zero,” basically the first place you will begin making systems for your game.

Now make a prefab for each type of terrain type in this world: forest, mountain, water.

Now make a scene with 10x10 of those prefabs dragged into the right spot in a grid. You can use snapping to quickly position each one.

Now move onto the next layer: what is AT these locations: city, cave, encounter, etc.

Again, make a separate set of prefabs for each of these things that may inhabit the world at that location.

This is the kind of iterative approach you have to use, because there is no way unless you are able to juggle 100 things in your mind at once that you can do it all at once.

Once you have the above working, move the player (make him just a cube or sprite) over those areas.

NOW you can start doing things like checking every time the player moves which GameObject he is closest to, and look for special marker scripts on those gameObjects that tell you “hey, there is a city here, give the player a button to enter the city if he wants to.”

Thanks for the reply! So you’re suggesting I go for an in-scene world map system rather than putting it in the UI?

So the prefabs with info I made preemptively actually as I was experimenting with grids. I made some for the Canvas UI and I made some in the 3D space as well. I haven’t been able to find a good way to move the player icon on the grid in a sort of locked way. I don’t want him sliding all over the place haha.

The biggest issue I’m still having is that this world map is affected by all the stuff going on in the main game. So when it’s night time in the game and I pull up the map, the camera switches to the map but then it’s really dark. I tried giving the map a light but it looks like a spotlight on the map and just looks bad.

I’m ok with the map not being a UI element, but I want it to behave like a UI element.

Does that make sense? Again, this world map is not the game, just a world map.