I’m in the process of making a multiplayer, first person shooter game, and is having some troubles at this moment, according to the particleSystem. I’m using photon because of their cloudsystem.
The Problem: The other clients cant see my particles. I have earlier had a problem, where all clients were shooting, when one client triggered fire, this is avoidid by assigning the specific player id, to the function, which makes only the one client, that is triggering fire, fireing. The problem is, that whether or not the other clients are being triggered, can’t the other clients see eachother particles.
many PRE_THANKS.THANKYOU
using UnityEngine;
using System.Collections;
public class Shooting : Photon.MonoBehaviour {
public int damage = -10;
public Transform effect;
void Start()
{
gameObject.name = gameObject.name + photonView.viewID;
}
void Update ()
{
if(photonView.isMine) {
if(Input.GetButton("Fire1"))
{
photonView.RPC("Fire", PhotonTargets.AllBuffered, gameObject.name);
}
}
}
[RPC]
void Fire(string name)
{
if(gameObject.name == name){
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width/2, Screen.height/2, 0));
if(Physics.Raycast(ray, out hit, 1000))
{
GameObject particleClone = Instantiate(effect, hit.point, Quaternion.LookRotation(hit.normal)) as GameObject;
hit.transform.SendMessage("AddjustCurrentHealth", damage, SendMessageOptions.DontRequireReceiver);
// Debug.Log(ray.origin);
// Debug.Log(ray.direction);
// Debug.Log(transform.position);
Debug.DrawRay(ray.origin,ray.direction,Color.green,2,false);
}
}
}
}