Can I have a moving shape as a trigger zone?

I have the following problem:

I want to have a first person player be able to interact with objects around the level. Nothing too complicated; when the player gets within range, and is looking at the object, they can press E and it will play a sound.

Someone recommended I use trigger zones around objects to detect when the player is within range. To me it would make more sense to add a cylindrical shape just in front of the player and have that be the trigger zone, rather than lots of different trigger zones.

Is it possible to do this? Can I attach a trigger to the player and have all game objects I want to interact with in an array?

I’m working in C# so if anyone has any code to help demonstrate their answer that would be great.

yes, this is for 3D setup as you didn’t specify 2D or 3D.

Create an empty GameObject to your player and Add Component to that for a capsule collider.

Tick is trigger and resize so it’s bigger than the player. You can move offsets to say where it appears. Move it so it’s not triggered by the player, like this:


You should be fine with that. I tested it with a cube with a rigidbody that drops onto it.

using UnityEngine;
using System.Collections;

public class hitSomething : MonoBehaviour {

	void OnTriggerEnter(Collider other)
		Debug.Log (;

And the debug prints out cube.