Can't read variables from DefaultEngine.ini file. Going crazy!

Hi @QubaXR

I was referring to deleting them individually. When I’m finishing a product I always you remove the Saved folder and the intermediate folder. They’re not needed for the final product and would be removed upon submission to Unreal Marketplace usually as well. To be safe, when you delete them don’t permanently delete them. They should be inside your recycle bin where you can restore them if needed. (Or just copy and paste them from your project folder to your desktop and put them back if needed)

Were you able to get it resolved?

No, nothing helped and I feel like I am exploring more and more weird avenues, whereas the problem seems to be more fundamental.

I think I might have run out of time to work on this. May end up just buying a savefile management plugin and use that…

Hey!!
After some discussion with chatgpt, i am guessing we have to create custom .ini file and retrieve data from that .ini. After packaging, this custom .ini file is untouched and will remain in config folder of build and so if you change values in this, it should work.

Were you able to test and confirm this? I haven’t attempted this method.

Will have to try. Come to think of it, I did start with custom .ini files - but that was before I learned the variables cannot be on the pawn… I think I first moved the data to EngineDefault.ini and THEN changed from pawn to custom BP.

Should try it!

TL;DR - did not work.

Here’s the story:

  1. @Ram07 ChatGPT likes to either hallucinate answers, or make them so generic, they don’t really help. Still I tried making random ini files - it would just ignore them, unless I adhered to the naming convention below:
  2. I used Epic’s Configuration File Hierarchy as a reference.
  3. I tried nearly every single option on this list:
Engine/Config/Base.ini
Engine/Config/Base<CATEGORY>.ini
Engine/Config/<PLATFORM>/Base<PLATFORM><CATEGORY>.ini
Engine/Platforms/<PLATFORM>/Config/Base<PLATFORM><CATEGORY>.ini
<PROJECT_DIRECTORY>/Config/Default<CATEGORY>.ini
Engine/Config/<PLATFORM>/<PLATFORM><CATEGORY>.ini
Engine/Platforms/<PLATFORM>/Config/<PLATFORM><CATEGORY>.ini
<PROJECT_DIRECTORY>/Config/<PLATFORM>/<PLATFORM><CATEGORY>.ini
<PROJECT_DIRECTORY>/Platforms/<PLATFORM>/Config/<PLATFORM><CATEGORY>.ini
<LOCAL_APP_DATA>/Unreal Engine/Engine/Config/User<CATEGORY>.ini
<MY_DOCUMENTS>/Unreal Engine/Engine/Config/User<CATEGORY>.ini
<PROJECT_DIRECTORY>/Config/User<CATEGORY>.ini
  1. I also constructed a quick new project that has nothing else in it but a simple screen widget displaying two variables (marked as “Config Variables”)
  2. While in Editor, but using the Standalone Game preview button, the project reads any of these ini files perfectly. I run the preview, it reads current values. Close preview, change ini file, run another preview - new values are in.
  3. The moment I Package the Project, the values from the ini file (at that time) get baked into the project.
  4. Packaged project does not have any folders with ini files in them (they are inside a PAK) and displays whatever values it read at the moment of packaging.
  5. For a while I was hoping that placing the ini outside of the project folder (My Documents\Unreal Engine\Engine\Config\UserEngine.ini) would help, but the same situation persists. Once packaged, the project becomes deaf to any ini files - either ones that existed while packaging, or new ones.
  6. @FrostyJas Deleting directories inside the project (both pre-packaging and after-packaging) does not yield any results.

In essence - it looks like the engine reads the ini only at the time of packaging the project.

There must be some way to fix this - Unreal Docs, if I am not vastly misunderstanding, claim it is possible.

let me try once for you, so in short, you want to change values in .ini (whether its custom or defaultengine) and they should reflect in package game without packaging again right?

@Ram07 Correct. I am not married to any specific ini file, as long as it is a simple text file I can edit to affect already packaged project.

If you want I can quickly zip and share the test project I’ve been working on.

I got this working!!

First, i have created a function like this


Here

  1. Get platform user dir gives the location of documents folder in PC and Config.json is our file name
  2. so, you can ask them to keep your config.json in their documents folder, like when you share the zip
  3. load file to string is the c++ function


    Here are .h and .cpp logic
  4. You can select blueprint function library class while creating c++ class
  5. Varest plugin is used and those nodes - decode json value, as object are from that plugin
  6. and lastly, here is the sample json which i tested on
  7. so as you can see, via code, i can retrieve string field of Test and set to whatever variable i want and btw, i called this load config json function in begin play of third person character and function is also created in TPC
2 Likes

This is awesome @Ram07 though I was looking for a solution without the need to learn how to do C++… I am a 100% BP person. I really don’t think I have the bandwidth on my side to now learn how to use VS, create classes etc…

Not that I don’t appreciate your help, but I guess I will just buy a plugin from marketplace. There seem to be a ton of ones to do this. Had my eye on one called ConfigBP

sure

You were able to get it working, @Ram07?

yes

@FrostyJas Just to be precise, @Ram07 did not find a way to read the .ini files in BP, but instead came up with another solution, featuring a plugin, C++ code and storing variables in a JSON file.

(post deleted by author)

Good deal! I’m glad you got it working.

2 Likes