I cant kill the other player.

So i have a multiplayer game i am working on, i got every thing working fine now only one problem that i have got a few days now.

I can see other bullets fly, they bounce whay from player 2 if i shot with player 1.

But it dont reduce the life...

var Bullet:Transform;

function OnControllerColliderHit(hit : ControllerColliderHit)
{
    if(networkView.isMine)
    {

        if(hit.gameObject == Bullet)
        {
        Statics.Life -=4;
        }
        Debug.Log("Test: "+hit.gameObject.tag);
    }

}

The "Test" only tells me that i touch the floor...

1 Answer

1

I take it this script is on the player? Have you assigned Bullet to the instance of the bullet coming in?

Perhaps a better way would be to tag Bullet's with a new tag (say, Bullet) and check the tag of the hit.gameObject to see if is tagged Bullet (if so, decrement life)