Collision Detection Randomly Ignores Hits

The Problem:

I Instantiate special affects & projectiles that use a collider to detect whether it has hit a unit. If it hits the unit it does damage. Units are not being hit by the special affects despite the fact that they are clearly within it’s collider. Units that are more recently created have a higher chance to ignore the collision.

Video

http://www.youtube.com/watch?v=EJAWFzkJ5XY&feature=plcp

The Details:

The units have Rigid Bodies, and they are detected about 30% of the time. When paused it is clear that the colliders overlap.
The collision is detected by using the OnEnter Trigger. I have also tried On Stay, and the only change is that when it actually detects a collision it triggers every frame instead of once(As it should), but still detects nothing more often.
It seems that the chance of a collision being detected is increased if the Unit has moved or been acted upon in some way. (Such as moving to a new location)
I have tried increasing the Collision Detection field on the Rigid Body. No matter the setting, the results don’t seem to change.

The code for this is very standard. I check send the collider to another function which deals the damage or spawns effects. The _Attacker is the attacking unit and _EffectAttack & _SpecialAttack are classes that contain the amount of damage or effect to spawn. The code does not even hit the Debug lines which tells me that it is flat out not colliding.

void OnTriggerEnter (Collider collisionObject) 
{
	Debug.Log("Attacker: " + _Attacker);
	Debug.Log("Hit: " + collisionObject.gameObject);
		
	if(_EffectAttack != null)
		InitiateAttack(_EffectAttack,  collisionObject.gameObject);
	else if(_SpecialAttack != null)
		InitiateAttack(_SpecialAttack,  collisionObject.gameObject);
}

I updated to the latest version of unity a few days before I noticed the issue, so I’m thinking it might be a bug in Unity, but I’m not sure.

Could the problem be associated with using an Instantiated Collider to detect an Instantiated Rigid Body?

Has anyone else experienced similar issues and what steps were taken to fix it?

The problem is that you instantiate a collider/trigger. This is not a problem per se, but colliders(especially sleeping ones) that are in its range will not trigger any of the events until they are moved/woken up. And even then the enter might not fire because they are already in the collider, not entering it.

Now, for a proper solution you shouldn’t do the check by creating a collider, but by using one of the various checks that physx provides. For example: http://docs.unity3d.com/Documentation/ScriptReference/Physics.OverlapSphere.html

Attach a rigidbody to the thing with the sphere collider and it will wake up the units presuming it is itself awake. See here for details.