How to change values of custom resources via code?

Godot Version

v4.1.1.

Question

I’m having a custom resource with coulpe of bool values. How do I change them from off to on or vis versa in code?

I tried the obvious by just setting it, but it didn’t worked.

anfragen_Label_instanz.beschwerden.ablehnen_dis = true

(
“anfragen_Label_instanz” is the var that contains a node with a script attached that contains the var “beschwerden” which contains my custom resource which contains the bool variable “ablehnen_dis”
)

anfragen_Label_instanz.beschwerden.ablehnen_dis.set(true)

Didn’t worked either.

This is correct, if all you said is true. So I suspect the error is something else, like beschwerden not being your custom resource instance or similar.

Please show the error message you get and the code where you define beschwerden

I don’t get an error, but I see on the inspector that the value in the custom resource isn’t true.

Do you set this in-game? If yes, then make sure to use the remote tree to inspect the resource. Otherwise you will see the in-editor value, not the live value.

Also the inspector may not pick up changes, especially if you change the value in-editor via a tool script. In those cases you need to inform Godot that the value changed by emitting the notification.

But again, show the code. Otherwise all we can do is guessing what the issue is.