I am having a lot of trouble trying to figure out how to set a variable from DefaultGame.ini from a blueprint. There doesnt seem to be any useful documentation about it, only C++.
What I have so far looks like this in DefaultGame.ini
[/Game/testActor.testActor]
test2="hi"
test=5
I have Config Variable checked for both variables. However they just wouldnt load the correct values. I suspect I have something wrong in the section name. I am not sure how to set it. Where to get the correct package name, and is the class name correct in this case?
If you mouseover the Config variable checkbox in your class’ variable settings in the editor, the tooltip should tell you the path you need to enter as class identifier.
At the very least, you’ll need to add a “_C” to the string, i.e. “testActor.testActor_C”. I also think you might have to edit DefaultEngine.ini, but that’s something the tooltip will also tell you.
That’s strange. I have UE on two computers (4.8.2 at home and 4.8.3 at work) and both show the detailed tooltips. I’m fairly sure I haven’t added any plugins.
Basically, you need to do the following:
add your config variable to the DefaultEngine.ini
add a section containing the relative project path to your class, starting with /Game as the Content folder
In my case, the class is called CombatComponent and is placed in Content/LevelProtoype/BluePrints folder.
Assuming you’ve created your Blueprint in StarterContent/Blueprints, the section would be
I think that if the parent class is Actor is possible.
However, if it is inherited from the PlayerController, it is impossible to achieve.
Good luck !.
hi 二十七杯酒
thanks for your answer.I found you are right
but if I only want some variable in PlayerController or Gamemode can be config.how can I achive this function?
I know this is an ancient post, but just to clarify what actually worked for me, because the tooltip hint text misled on two points:
1 - It suggested ‘Config File: [Game]’ but in fact a successful read happened when I moved the section to DefaultGame.ini. I had taken their hint as meaning to create a new config, Game.ini, and use that but that didn’t work;
2 - The simple form of Blueprint reference is what worked: e.g. /Game/Blueprints/Gameplay/BP_GameInstance.BP_GameInstance_C. The hint text was suggesting ‘/Game/Blueprints/Gameplay/BP_GameInstance.SKEL_BP_GameInstance_C’ which did not work.