# Set collision complexity for StaticMesh assets using Python.

**URL:** <https://forums.unrealengine.com/t/set-collision-complexity-for-staticmesh-assets-using-python/150886>\
**Category:** Editor Scripting\
**Tags:** unreal-engine\
**Created:** [September 19, 2020, 8:42am UTC](https://forums.unrealengine.com/t/set-collision-complexity-for-staticmesh-assets-using-python/150886 "2020-09-19T08:42:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_f92919d11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f92919d11](https://forums.unrealengine.com/u/anonymous_user_f92919d11)\
**Post date:** [September 19, 2020, 8:42am UTC](https://forums.unrealengine.com/t/set-collision-complexity-for-staticmesh-assets-using-python/150886/1 "2020-09-19T08:42:13Z")

</div>

I have a bunch on StaticMeshes I would like to use one type of collision complexity, and there is another bunch, where I want to use another… hundreds more coming…  
So setting up the default complexity in the Project settings is not an option.

I found [this article](https://www.freecodecamp.org/news/becoming-an-unreal-automation-expert/amp/#writing-our-own-automated-project-clean-up-script-using-python)to start my Python journey.

So I wrote similar scripts to change anim retarget sources on animation sequences. They worked fine.

```auto

import unreal

#create unreal class instances
editor_util = unreal.EditorUtilityLibrary()

# get the selected assets
selected_assets = editor_util.get_selected_assets()

for asset in selected_assets:
     asset.set_editor_property("retarget_source","my_retarget_name")

```

So I thought if I change the last line:

```auto

asset.set_editor_property("collision_complexity","SimpleAndComplex")

```

would work. I know I am a bit optimistic about this script working,  
because I have not found the Python property [here](https://docs.unrealengine.com/en-US/PythonAPI/class/StaticMesh.html), but I was hoping it is just in another class, and Python is  
just going to find it somehow…

Well I was wrong, I guess I have to do some more to get it work.

I am getting these on screen after running the script in the editor.

```auto

LogPython: Error: Traceback (most recent call last):
LogPython: Error: File "<string>", line 13, in <module>
LogPython: Error: Exception: StaticMesh: Failed to find property 'collision_complexity' for attribute 'collision_complexity' on 'StaticMesh'

```

Am I missing out something?  
If not is there a workaround?

---

<div class="post-metadata">

**Author:** ![darkczar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@darkczar](https://forums.unrealengine.com/u/darkczar)\
**Post date:** [October 16, 2020, 8:46pm UTC](https://forums.unrealengine.com/t/set-collision-complexity-for-staticmesh-assets-using-python/150886/2 "2020-10-16T20:46:21Z")

</div>

Did you ever figure this out? I just need to get the current value of CollisionComplexity.

---

<div class="post-metadata">

**Author:** ![miaomioa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@miaomioa](https://forums.unrealengine.com/u/miaomioa)\
**Post date:** [October 18, 2020, 5:25am UTC](https://forums.unrealengine.com/t/set-collision-complexity-for-staticmesh-assets-using-python/150886/3 "2020-10-18T05:25:56Z")

</div>

```auto

MeshPath = '/Game/Obj/M10/Mesh/' StaticMesh_mesh_list = get_path_all_asset(MeshPath, unreal.StaticMesh) for i, name in enumerate(StaticMesh_mesh_list): Body = name.get_editor_property('body_setup') Body.set_editor_property('collision_trace_flag', unreal.CollisionTraceFlag.CTF_USE_COMPLEX_AS_SIMPLE) name.set_editor_property('body_setup', Body)

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f92919d11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f92919d11](https://forums.unrealengine.com/u/anonymous_user_f92919d11)\
**Post date:** [October 24, 2020, 12:19pm UTC](https://forums.unrealengine.com/t/set-collision-complexity-for-staticmesh-assets-using-python/150886/4 "2020-10-24T12:19:25Z")

</div>

> **[Python: Eneble UseComplexAsSimple collision for static mesh?](https://forums.unrealengine.com/questions/922729/python-eneble-usecomplexassimple-collision-for-sta.html)**
>
> Is it possible with python script enable UseComplexAsSimple for mesh? I cant find it in references.

---

<div class="post-metadata">

**Author:** ![liyangyang0901](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@liyangyang0901](https://forums.unrealengine.com/u/liyangyang0901)\
**Post date:** [March 3, 2023, 2:36am UTC](https://forums.unrealengine.com/t/set-collision-complexity-for-staticmesh-assets-using-python/150886/5 "2023-03-03T02:36:04Z")

</div>

That’s totally correct!
