Trigger not registering hit when a object in trigger area that's timed to turn on/off

Hi all,

I have a trigger at the moment that turns on and off. It works OnTriggerEnter and OnTriggerStay, with the renderer and collider set to turn on and off to a timer in update; it’s like a blinking laser. The objects I move into it are dragged with the mouse, using a version of the DragRigidbody script.

It turns on and off fine and works when I drag something into it while it’s on (in this case, it should destroy whatever the trigger hits).

What doesn’t work is when I move something into it while it’s off, and then leave it there (ie, stop dragging it). Once the laser comes back on, it doesn’t register anything in either the OnTriggerEnter or OnTriggerStay functions. But if I go to drag the book, it then works (I don’t even have to move the book, so I know it’s hitting the collider, a simple click on the object will make the trigger register it).

As it’s not even registering any object in the Trigger, I’m assuming it’s an issue with the trigger.

Any ideas?

Sorry, but I figured out the answer myself. After doing some more googling, it seems Triggers only work on moving objects (if someone could correct me on that I’d appreciate it). I tried a few other options that worked for others (like adding a rigid body to the trigger) but that didn’t work.

What did work was changing the timer so only the renderer turned on and off, not the collider as well. And then I put a check into the Trigger functions to check whether the laser was on or off before calling the functions I want. So instead of the whole trigger turning on and off, only the functionality and visuals is turned on and off.