I am trying to call a variable from a blueprint actor and set it to true. It works in the Editor but I can not seem to get it to work in a package. I am using “Get All actors of Class” to get the variable from the BP and then I set it to true. I am not sure if it is a blueprint issue or something is wrong in my package settings.
Hello Cramzi,
Would you mind giving as some more information, as your problem isn’t quite clear to me. Is an exception thrown, or isn’t the behavior as expected?
I am running a Sphere trace to an object, and if it hits the correct object (checking by display name) then it would access that Bp actor and set a variable.
Thank you for your reply. I had to step away from my computer for a bit. But I will give that a try when I get back.
Thank you.
That seem to do it, Thank you very much.
Hello Cramzi,
thank you for answering, so I guess the behavior isn’t as expected, as they don’t change their material in the packaged project?
Just a friendly advise, as your blueprint code isn’t optimal. You already get an actor form the spherecast (if it hits anything), so why not use that instead going over all actors again? You can cast the hit actor with a cast to the type you want to check for (it should be named ‘cast to (insert the bp_classname here)’). This would also eliminate the check for the display name, string checks are not really performant, and you wouldn’t have to remember and edit the code if you decide to change the name of the actor.
In OOP you want to expose as little as possible from each class, so I’d recommend using a function, to call from the actor if the cast is valid, and I’d check if you can combine the actors ‘A_East’, etc. into one blueprint class, as they probably do the same, and expose a parameter to determine their difference.
I don’t really see when the check, ‘if selected’ get’s called, have you checked if this statement actually gets called inside the packed project?
Here are some mockups for better understanding:
Depending on what you need, you might need to go over all selected objects and deselect them.
And inside the selectable blueprint.
Just let me know, If I was way off course or if things are still unclear.
That’s good to hear.