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

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.

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:

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.