Aquaplaning Particles not showing? (multiplayer)

Hi,

I’ve made some watersplash effect that is on the water surface when my flying car(player) is sliding/aquaplaning, and it’s a beautiful thing except none of the other players can see these two particle systems that ar child objects of each of the instantiated flying cars and each have Photon view on them.

I calculate the distance to the surface with a RayCast to determine when to turn on and off the particle systems and I check if Photon is mine and PunRPC the function that shows particles on or off… WHY IS THIS NOT SEEN BY OTHERS IN THE GAME!!! Sorry :smile: But srsly why?!

I’m using Photon and here’s my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CheckWater : Photon.MonoBehaviour {

    public float distanceWater;

    public bool isGrouded = false;

    public Rigidbody rb;

    Vector3 targetLocation;
    RaycastHit hit;


    public ParticleSystem aQuaplanningParticles;
    public ParticleSystem aQuaplanningParticles2;

    // Use this for initialization
    void Start () {
        distanceWater = GetComponent<CapsuleCollider>().bounds.extents.y -1f;

    }

    // Update is called once per frame
    void Update () {
        //ShowPlaningParticles();

        if (photonView.isMine)
        {
            //photonView.RPC("ShowPlaningParticles", PhotonTargets.All);
            ShowPlaningParticles();
            photonView.RPC("ShowPlaningParticles", PhotonTargets.All);

  

        Vector3 targetLocation = hit.point;
        if (!Physics.Raycast(transform.position, -Vector3.up, out hit, distanceWater /*+.1f*/))
        {
            isGrouded = false;
            //aQuaplanningParticles.SetActive(false);
        }
        else
        {
            //aQuaplanningParticles.SetActive(true);
            isGrouded = true;
            //targetLocation += new Vector3(0, transform.localScale.y / 0, 0);
            //aQuaplanningParticles.transform.position = targetLocation;
        }
        targetLocation += new Vector3(0, transform.localScale.y / 2, 0);
        aQuaplanningParticles.transform.position = targetLocation;
        aQuaplanningParticles2.transform.position = targetLocation;

    }
    }



    [PunRPC]
    void ShowPlaningParticles()
    {


        if (isGrouded && rb.velocity.magnitude > 5)
        {
            //aQuaplanningParticles.emit = true;
            //aQuaplanningParticles2.emit = true;
            aQuaplanningParticles.Play();
            aQuaplanningParticles2.Play();


        }
        if (!isGrouded)
        {
            //aQuaplanningParticles.emit = false;
            //aQuaplanningParticles2.emit = false;
            aQuaplanningParticles.Stop();
            aQuaplanningParticles2.Stop();

        }
        if (rb.velocity.magnitude < 5)
        {
            //aQuaplanningParticles.emit = false;
            //aQuaplanningParticles2.emit = false;
            aQuaplanningParticles.Stop();
            aQuaplanningParticles2.Stop();

        }

        if (rb.transform.position.y <= -1.65f)
        {
            isGrouded = false;

        }
    }

}

You’re probably only going to solve this by putting in some onscreen debugging that tells you what is going on with the remote PunBehavior, the specific parts that are failing. I’m not sure what all is serialized but it might help you identify properties that aren’t making it to the remote.

1 Like

Okay thanks. I’ll try on screen debugging

1 Like