Big Selective Trigger Collider

Hey! I’m fairly new to Unity and C#. Trying my first project on my own after doing the tutorials on the site.

  1. I’m using a huge trigger collider that moves around and I need it to constantly interact with game objects of a certain type that enter it. I’ll probably use a tag to pick out game objects that should trigger the collider, but I’m a little concerned that this will still be really taxing. Do I need to worry about that? For example, I don’t need it checking whether elements of the environment have the correct tag or not every update. Is there a way to have it just completely ignore most of the scene?

  2. Is there another way to do this while freeing the game objects’ tags up for another use?

  3. Would it be simpler/more efficient to have the other objects send something to the big trigger collider when they enter it instead of having the trigger constantly checking for them? Can you use trigger colliders that way?

  1. Yes, setup a layer for your trigger and for the objects that he has to check, then go to Edit → Project Settings → Physics, and uncheck anything you don’t want it triggering with.

  2. Yes, you can check if the position of the object is inside a radius based on a reference position, like the player, if is faster? don’t know, but i personally would use trigger, just because is easier to setup, and its not “taxing” at all, you can use the profiler to check it out yourself, but hardly a single trigger would be reason for any spike rate. Always keep an eye out on the Phisycs Layer setting, no need to check any collision or trigger if they are not relevant.

  3. Don’t think so, instead of a single OnTriggerEnter, you would have one for each object. Note that for objects to know they are inside the trigger you would need some check if this statement is true.