i can't find the way to assign a material to a CachedGemotry with python scripting.
On staticGeometry i can do it with ".set_material" but the function dont exist on CachedGeometry.
Do you have a solution?
Thank you!
i can't find the way to assign a material to a CachedGemotry with python scripting.
On staticGeometry i can do it with ".set_material" but the function dont exist on CachedGeometry.
Do you have a solution?
Thank you!
I assume you mean GeometryCache when you talk about CachedGeometry or am I mistaken?
Assuming I'm not (apologies if I am) then you will be able to do this by modifying the 'materials' property on your GeometryCache object.
import unreal
# Gets Pre-existing objects
cached_geo_asset = unreal.load_asset(‘<GEO_CACHE_PATH>’)
mat_asset = unreal.load_asset(‘<MATERIAL_PATH’)
# Display materials before update.
print(‘Before’)
mats = cached_geo_asset.get_editor_property('materials')
print(mats)
# Override the existing materials to use only the one loaded
# above.
cached_geo_asset.set_editor_property('materials', [mat_asset])
# Display materials after update.
print(‘After’)
mats = cached_geo_asset.get_editor_property('materials')
print(mats)
I hope this helps! I haven't used GeometryCache much so I would be curious to hear if this solutions works out for you.