You are casting your pawn into a switch, which it is not, so the cast fails. If the switch is an actor in the world you should have a reference to it somehow, and store it in a variable in the MySwitch type (or just use it).
You should first get the reference to the switch actor somehow.
The switch isnt an actor in the world, I’m guessing then the solution you provided will have to be tweaked?
I do have other variables in my pawn class which are being set in different locations which is why I can’t understand why the different methods I have tried have failed.
Basically I have a section in my pawn blueprint that records data, I want to put a boolean just before it to switch between recording & not recording. I want certain levels in my system to allow recording and one or two to not allow recording. So this record switch would be set in the level blueprint and read from the pawn blueprint. I’m only setting it here to test.
I don’t think actors in the level can read from the level blueprint, when I’ve tried it it resulted in a big error, but the level blueprint can set a variable on a pawn, so I would do it like this
Of course if you want to set a boolean for recording you can do so after the first branch.
On levels that cannot record, just do not set CanRecord at all as the default is false, or maybe if the minority are levels that cannot record, set CanRecord’s default to true and set it to false only on those maps.