I have spent about a month working on this specific problem and have done quite alot of research before having to ask this question. Here is my scenario. I have multiple rows of objects, each object is an instance of the grid blueprint. When a my mouse object overlaps the object and the left button is clicked, the menu blueprint pops up. This allows for the player to select an object to replace the instance of the grid blueprint with an instance of a different blueprint. Everything works fine until the player selects what they want. At this point nothing happens and the new blueprint does not spawn at all. I am assuming this is because the transform that I am passing from the grid blueprint is out of scope.
Here is the grid blueprint setting the variable Grid Transform to be passed through an interface.
The is the function Grid Location that is from the interface. as you can see the (Variable is not in scope)
Everything compiles and there are no errors that come up. I do have variables in each blueprint as target blueprint of the other. I am at a stand still until I can get this to work. I have been able to pass other variables and they work the same way this does but for some reason this situation does not. I would really appreciate any feedback. I will be happy to answer any questions if my post did not have enough information.
Get all actors of class returns an array of actors which you shouldn’t be able to connect to a function (but somehow you did it without warnings). What you need to do is either create a “Get” node by extending the “Out Actors” pin and get the item at index 0 (which is the first instance of the item) or use a ForEachLoop node. Either way I don’t think this is an intuitive way of going about it. If you want to replace only the grid that the mouse hovers on, do a line trace, get the grid actor and run a replacement setup on it.
Thanks to alperenakyuz I have had some mild success. I have been able to delete one grid actor and replace it will a different one after selecting an option from the menu. Sadly it still is not passing the instance that is being used. It randomly selects one from with in the world. Here are a few screenshots of the changes that I have made to get to this point.
Grid BP that the mouse object overlaps and opens the menu after a left click.
Thank you alperenakyuz for your reply. I have not been able to find how to do a replacement setup that you had mentioned. If you could link me to something similar that might show me an example that would be well appreciated. I have also been experimenting with the line trace from the mouse but I have been unsuccessful getting that to do anything. I will continue to work with that. You also mentioned that the fact I’m getting all actors of class and sending that to my function shouldn’t work. I’m just going off other examples and it has been the only way to get my interface functions to work. although they do still show out of scope. I am all for going about all of this in an intuitive way and would love any more suggestions that come to mind. Thanks again for taking the time to answer.
Ok alperenakyuz was right. It was much easier to set the Blueprint and transform using the mouse blueprint with “Event Actor Being Overlap”. Here is what I had done to make that work.
Here is the mouse bp event setting the variables that are sent to the interface.