Hi, I’m making a simple Editor Utility Widget mainly to set debug variables quickly in my game.
one of them is a bool in my characterBP named “bLoadInitialDialogue”, and the other bool is in my game instance, named “bLoadLastSAve”. there’s also a string variable in my game instance with the game version i’d like to set up from this EUW.
the traditional way to do so would be casting to the player character, or the game instance, and setting those variables, but since I want to edit these values in the editor, and not during run time, casting doesn’t work, and I’m not sure how exactly to indirectly change a value from a blueprint class variable instead of a spawned actor in game.
Do you want to change the variable for the asset in the content folder or for assets that are in your level?
You cannot use the standard methods like simple casting as the game is not running usually while the EUW is being called.
Depending on the answer there are different methods to achieve this.
Right yeah, the two classes I want to change default values are: my custom player character, and my game instance, which are not in the level.
if there was a way of doing so in blueprints, it would be fantastic. but if not, I would give a try with C++, as I’ve been opening these two blueprints thousands of times a day to change those values for debugging
no idea why the first print string returns the blueprint, but the second returns empty.
Also, just spent the last hour trying to get chatgpt to produce a python script for that, without any luck, so I guess I shouldn’t bother asking it to give me a c++ code
I burned my head for a bit trying to make the checkbox stay checked when compiling the EUW, just to realize I could use your function itself for that lol:
You can just tick save asset on the final set property node in the chain. No need to save asset changes mid property change. It will speed up the process. Just save out at the end.
I was thinking about maybe passing in an key value array as an input, but I didn’t want it to be too complex.
Instead of enforcing the checkbox default value to true, perhaps a reverse function could be used to read the value.
Ah, makes sense to save only in the end, but in this case it’s two different assets, so I suppose it’s needed?
the second node in the chain I’m changing a “buffer” variable in the EUW itself that holds the checked state for its own checkbox, which is called on construct to set the checkbox state every time I compile the blueprint, so it retains the current state when I’m doing changes to it
So i tried to use your function with a text variable and a string variable, but it doesn’t seem to work. Are there any quick changes to make it work with different types of variables?
edit: nevermind, just had to append quotes before and after the string, text. it works great!
I suppose it’s not a problem storing all my “global” variables there since I can access game instance anywhere, but it’s just odd that the player character BP doesn’t recognize the bool value, even though it appears to be set correctly.
It depends on how your blueprint is setup. The python script changes the default object variables. If you have “Instanced editable” turned on for the variable then it can change from instance to instance.(you would need to modify the spawned in level actors in parallel to keep instances in sync)
I would either have to extend the function to allow for instance vars to be captured or you can turn off instance instance editable and the variable will be in sync
No need for extra global var complexity.
Uploaded with cache just to keep information so slightly higher size
I thought it could be the case, in fact during testing with a TestBP, it behaved like you showed, so I had it turned off in my character, but it didn’t do it. Then I’ve done some testing and apparently it’s related to parentage.
my player character is a child of “IsoPlayerCharacter”, and I have that ShowInitialDialog bool set in the parent class, not the child.
If I drag a base “IsoPlayerCharacter” into the world, it works, but it doesn’t if I drag a child class.
So even if I have the Dialog function set in a parent class, I need to have your function pointing to the actual final spawned class, then it works, even with “instance editable” turned on
A bit odd since it looks like I’m actually changing the default value of the parent BP class, but if you change the parent bool in the parent class BP, it changes the value of all child BPs, but changing via your code it seems to be changing only the parent bool, not the child bools:
It’s an inherited class. It’s doing what it’s meant to
You have the
parent A => bool set to true
child B => inherits bool setting from parent.
If you change the parent variable then the child will follow, unless you manually set the child variable to the inverse of the bool, only then will it be marked the the return to default icon