How do I use "get hit result under cursor" to select an item in an array?

Hi there! I’ve been trying to make a Civ-like game for fun but I’ve hit a slight wall. I’ve watched a few tutorials where the presenter was making a chess game and it had a highlight option where you use “get hit result under cursor” to select a square and highlight that square. However, the way he did this was odd to me. He basically used the Floor pathway and a division and modulo to feign/approximate what index he wanted to select via the real-world grid locations. This method seems incredibly silly to me, as well as not compatible for non-square grids.

I’d like to know how take the “get hit result under cursor” pathway and directly modify the item it hits. I am aware I need to somehow work with arrays, but I’m a tad bit confused how would I go about that?

Like this:


308918-

308920-findcomponent.gif

TY! This is great!

Hi, if you’re looking to save time on your chess game, or avoid tutorial hell, check out this free chess game creator for unreal engine https://www.youtube.com/watch?v=EDucHfBbvSY

It includes mouse hit detection on board squares and more