# Automatically adding / removing collision channels in C++ in Editor?

**URL:** <https://forums.unrealengine.com/t/automatically-adding-removing-collision-channels-in-c-in-editor/300317>\
**Category:** World Creation\
**Tags:** channel, unreal-engine, Collision, editor, question\
**Created:** [December 2, 2014, 4:51am UTC](https://forums.unrealengine.com/t/automatically-adding-removing-collision-channels-in-c-in-editor/300317 "2014-12-02T04:51:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nesis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nesis](https://forums.unrealengine.com/u/nesis)\
**Post date:** [December 2, 2014, 4:51am UTC](https://forums.unrealengine.com/t/automatically-adding-removing-collision-channels-in-c-in-editor/300317/1 "2014-12-02T04:51:07Z")

</div>

Howdy, just a simple question - what is the best way to go about adding collision channels in C++ in Editor? I want the process to be managed by code, with no user interface popping up. My intention is to enable level designers to add objects deriving from AActor to a level, each adding a unique collision channel, and removing the collision channel it created if the object gets deleted.

---

<div class="post-metadata">

**Author:** ![Olathuss](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Olathuss](https://forums.unrealengine.com/u/Olathuss)\
**Post date:** [May 23, 2022, 10:21pm UTC](https://forums.unrealengine.com/t/automatically-adding-removing-collision-channels-in-c-in-editor/300317/2 "2022-05-23T22:21:39Z")

</div>

The simple answer: Just use the provided enums for whichever collision channel you want to add.

The long answer:  
Technically speaking, the Editor doesn’t “add” collision channels, it just assigns a name and property to one of the 18 available channels the Engine provides for you.

These are:  
`ECollisionChannel::ECC_GameTraceChannel1 through ECollisionChannel::ECC_GameTraceChannel18`

When you “add” a channel in the Editor, it places a line to the DefaultEngine.ini like this:  
`+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="WorldTerrain")`

Which means, assign Channel1 this default response, name, etc.

I am not sure whether you can refer to the string name in C++ or not, I’ve personally never had any desire to do so. So you’d have to look into that yourself. But what you are trying to do should be simple enough in theory.
