Once again like many others before me: My trigger works once and no more. I only have a Debug message in the OnTriggerEnter and OnTriggerExit, but it calls only once.
There’s 2 different objects in this case: 1 spawner and 1 block. The spawner has a regular collider on it. The block has a regular collider ánd a Sphere Collider as Trigger. Once the player spawns a block using the spawner, OnTriggerEnter is called and as soon as the player moves the spawner away from the just-spawned block, OnTriggerExit is called as it is supposed to. When the player again moves the spawner into the block, nothing happens at all. This is the same with moving already spawned blocks into eachother.
The following part of script is situated on both the spawner and the block:
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag=="Block")
{
Debug.Log("TRIGGER ENTER");
}
}
void OnTriggerExit(Collider other)
{
if(other.gameObject.tag=="Block")
{
Debug.Log("TRIGGER EXIT");
}
}
I have also tried this without the tag check, but that gives the same result.
Does anyone have an idea what could cause this and how I would be able to fix this issue?
My guess is there is something in another script conflicting with this. It's hard to pin point because by just the script shown above it should work fine. There is something else going on behind the scene. This would be my first thing to check
– SelosoftWhat is a 'regular' collider ? How can you have two colliders on a single object ?
– nventimigliaAbout the 2 colliders: One of them is acting as an actual collider, the other is a trigger. Stingman: I actually think it's some script conflict too. Could this happen because i've got the 2 objects with the same script attached? Within the script it's checking for tags so i think it shouldn't matter...
– thuroneboth objects do not need the script attached. try that and if no luck feel free to post other scripts. also what nventimiglia was trying to say is true though... it is not possible to have more than one collider on the SAME mesh... so I assume you are saying you have 2 colliders on 2 different MESHES within the same OBJECT. make sense?
– SelosoftI found no conflicts between the scripts. Like I said in my previous post: Whenever I only use the trigger and not the box collider, only the OnTriggerEnter works. Whenever I have both enabled OnTriggerExit works too...But once. If there's any more information I can give you just let me know. This problem is really getting weirder and weirder :s
– thurone