# Checking for Custom Trace Channel in C++

**URL:** <https://forums.unrealengine.com/t/checking-for-custom-trace-channel-in-c/665631>\
**Category:** C++\
**Tags:** unreal-engine, CPP, question\
**Created:** [October 9, 2022, 1:00pm UTC](https://forums.unrealengine.com/t/checking-for-custom-trace-channel-in-c/665631 "2022-10-09T13:00:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [October 9, 2022, 1:20pm UTC](https://forums.unrealengine.com/t/checking-for-custom-trace-channel-in-c/665631/2 "2022-10-09T13:20:06Z")

</div>

> [@Custom trace channel in c++?](https://forums.unrealengine.com/t/custom-trace-channel-in-c/332130):
>
> I created a custom trace channel from the collision tab in project settings. It may sound stupid but I have no idea how to use my new channel in c++: for example I want to do a single trace using my custom channel, how can I do it? (I mean, when it comes to specify the ECollisionChannel parameter)

Basically you pass in the ECC\_GameTraceChannel with the correct index 1 -18, those are the custom ones you defined in the editor

For instance

```auto

FHitResult ATracer::DoTrace(FVector start, FVector end) {
	FHitResult result;
	FCollisionQueryParams qp;		
	FCollisionResponseParams resp;
	GetWorld()->LineTraceSingleByChannel(result, start, end, ECollisionChannel::ECC_GameTraceChannel1, qp, resp);

	return result;
}

Would hit the first custom trace channel

```

Remember to set trace to block for the custom channel on the object that is supposed to be tested against.

---

_[View the full topic](https://forums.unrealengine.com/t/checking-for-custom-trace-channel-in-c/665631)._
