Script Platform to cause death

Super new and trying to learn some stuff about Unity using the 2D platformer sample. I’m trying to create a platform that kills the player when they touch it, but if I make the boxCollider a trigger and use the DeathTrigger script, the character falls through the platform before they die. I’ve tried to use onCollisionEnter/Stay on the platform to send the same onDeath message, but it seems that the character would take those functions, and I’d prefer to tie the onDeath message to the platform instead of the character. Any suggestions?

thanks

You should probably start with a more basic example than the 2D platformer to learn from. Take a look at my tutorials at http://unity3dstudent.com and start from scratch, that should teach you some essentials that you need to understand the problem. To address your issue directly, you’d simply need to collision detect whether the player is landing on one of those platforms, so ideally if you are using the character controller component, use OnControllerColliderHit - see script reference on how to use it -

http://unity3d.com/support/documentation/ScriptReference/CharacterController.OnControllerColliderHit.html?from=ControllerColliderHit

Try turning the box collider trigger off?