- Home /
Question by
spacelyjoe · Feb 20, 2014 at 01:06 AM ·
networkingphotonshootbullets
Question about bullets and networking
So two people spawn, they both have the same script to shoot guns. What could I do to make it recognize which person it came from and so it only hurts the enemy (other person in the level)
void Update () {
if (photonView.isMine){
if (Input.GetKeyDown(KeyCode.W) && Time.time > nextFire){
nextFire = Time.time + fireRate;
GameObject bullet = PhotonNetwork.Instantiate("bullet", transform.position, transform.rotation, 0);
bullet.rigidbody.AddForce(transform.up * bulletSpeed);
Comment
Your answer
Follow this Question
Related Questions
How come my trigger won't register over a network? 0 Answers
Photon Unity Networking (Viking Demo) Error: Argument is out of range. 1 Answer
Networking already instantiated assets 1 Answer
Update position via state syncronization results in weird movement. 0 Answers
Photon Virtual Joystick won't work after another player has joined the network...? 1 Answer