Hello, I have added a parameter “Density” to my PCG graph and I am having trouble changing its value from python.
I am creating volumes from code and then attempting to set the parameter values. Here is an example:
python
myAsset = unreal.load_asset('/Game/MyGraph')
myActor = unreal.EditorLevelLibrary.spawn_actor_from_object(myAsset, unreal.Vector(0.0, 0.0, 0.0))
propBag = myActor.pcg_component.graph_instance.get_editor_property("ParametersOverrides") # PCGOverrideInstancedPropertyBag
params = propBag.get_editor_property("parameters") # InstancedPropertyBag
paramsValue = params.get_editor_property("value") # InstancedStruct
paramsValue.set_editor_property("Density", 0.5) # NOT WORKING
The last line triggers an error, because paramsValue doesn’t have the editor property “Density”.
LogPython: Error: Traceback (most recent call last):
LogPython: Error: File "<string>", line 6, in <module>
LogPython: Error: Exception: InstancedStruct: Failed to find property 'Density' for attribute 'Density' on 'InstancedStruct'
I’m new to using python in unreal and I’m doing this as an experiment. So I might be missing something obvious.
Can anyone help me set my “Density” parameter?