Trying to print a string causes an array pf actors not to spawn? How to fix this?

Hi. So I’m trying to build an array of objects and then to print the index ID of the one I click on. Sorta like a chess game, but with hexes. However, when I tell the blueprint to print the index that I printed, the entire board fails to spawn. WTF is going on?

See image below. Top one is no string, bottom one is trying to print string.

link text

There’s nothing here to suggest something is wrong. What code are you using to generate the hexes?

And the compile error?

Consider the following:

The tile actor with an Exposed and Instance Editable variable and a Custom Event that shows the index:

And we create the tiles, assigning indexes:

On click, we execute the event in whatever we clicked.

You can, of course, use your loops for creation, since you have the hex math in there working nicely, it seems.

Image from Gyazo

Thanks for taking the time to try! Here’s the spawner for the hexes

huh I just noticed that. It popped up on the find item part of the click function for the first image. But it goes away when I delete and recreate it. Why is it doing that?

What’s the point of trying to Find something in the array like this? You’ve just clicked the correct actor, right? If you need indexing, store the index on the Actor itself, fill that int as you create your hexes. Then, when you click on actor, get the index it stores.

Besides, you should consider reading the tooltip of Find, it does not do what you think it does.

Technically you should be able to match on the object reference. Try to cast the actor to a bphexobj before doing the find. But a far better solution is as @everynone says, put the index inside a variable of bphexobj after you’ve created it. Then when you check the hit, cast the actor to bphexobj and if the cast succeeds, grab the index.

You’re right. I was under the impression you must match type for Find to work, but it seems it works fine anyway. Still, the demonstrated method seems awkward.

Besides, you should consider reading
the tooltip of Find, it does not do
what you think it does.

I’m just gonna take my coat and re-read it myself then…

TY! I believe I got this working with some slight modifications from Everyone’s solution. I had to drop the left mouse button in my player controller to work, and did a few other minor edits for what I’m doing. Everything appears to be working now. For documentation, I’ve screencapped what I did to supplement Everyone’s excellent guidance. Thanks all!