(Player) - Player <ClickToMove, Capsule Collider (Rad: 0.6), Killable Script (Attack Points:1), NavMeshAgent> -- PlayerWeapon <RigidBody, Box Collider, Killable (Attack Points:25)> ) - i.e. has no renderer
What is supposed to happen is that the Enemy "Follows" the player until the Ranged Weapon Collider Triggers, at which point he stops moving (moves to stay in range) and an "EnemyBow" gets spawned which in turn spawns arrows at the Player.
What actually happens is that when the Enemy RangedWeaponRange Collider hits the PlayerWeapon (which is about the same time as it hits the Player) then the EnemyArcher immediately takes 25 points of damage and is killed. :-(
Is it normal that a child collider should trigger damage on a parent Killable? and if so, is there a way around this behaviour?
Whilst the Player Object is "in Range" i.e. an "onTriggerStay" equivalent, then an "arrow" gets fired at the Player, as soon as the player moves out of range the arrows stop (also the arrows self despawn after about 4 seconds).
on the RangedWeaponRange GameObject there is a Triggered Spawner Trigger Enter Event = true; Number to spawn = 1; Delay Wave = 1; Stop When Trigger Exit = true;
Repeat Wave = true; Pause Before Repeat = 0.2;
What actually currently happens is:
- Player comes in range - one arrow appears in the PoolBoss and is fired at the Player (despawns after the appropriate time) - No other arrows are fired
I can get the arrow to be re-spawned if I move the Player out of range and back in again.
I must be missing something because I would expect the arrows to be re-spawned repeatedly every 1.2 secs until the "OnTriggerExit" occurs at which point it should stop. I'm pretty sure it must be something I am doing so will continue to dig and let you know, but I am posting here just in case you have a "ahh thats a common mistake you need to do X" moment??
If that's the case, then I believe trigger exit is in fact occurring, whether it should be or not. Maybe a collision Unity bug? Did you try adding a script to log if/when trigger exit happens there on that same Game Object?
Unless you just didn't set up high enough limits on your item in Pool Boss...
hmm, so I threw a simple debug script onto the RangedWeaponRange Object listening for OnCollisionEnter/Stay, OnTrggerEnter/Stay/Exit etc and it gave me the following output:
I can see a DEBUG OnTriggerEnter: Player (1) and several DEBUG OnTriggerStay: Player (733) but no DEBUG OnTriggerExit: Player
separate (but linked) question, you mentioned about if i had set limits in the PoolBoss. Are you saying that if I have a Prefab placed in a PrefabPool I also have to add it to the PoolBoss because so far i haven't been doing this (but i do have Auto Add Missing Items checked)?
just in case i missed a tick box or similar, here is the RangedWeaponRange Inspector Window:
ok, so further to this it's definitely something to do with one of the scripts on the arrows themselves, if i create a simple cube, add a Timed Despawner Scirpt to it, it happily infinitely respawns... hmm.. Thanks for your time, I will let you know how i get on..