Unity - A计划(永久有效期) 扫二维码继续学习 二维码时效为半小时

(196评价)
价格: 4019.00元
关于Unet 子弹打中物体后的特效生成在客户端有时候看不到。
小白cs发起了话题2018-07-17
1
回复
548
浏览

请问老师要怎么同步,子弹是按照教程服务器发出的,下面脚本挂在子弹上,在本地都看的到自己子弹打中的效果,但是对方打出的子弹很大几率看不到命中效果,需要做同步吗?怎么做?

  private void OnCollisionEnter(Collision collision)
    {
        GameObject hit = collision.gameObject;
        Health health = hit.GetComponent<Health>();
        if (health != null)
        {
            health.TakeDamage(10);
        }
        AudioSource.PlayClipAtPoint(bulletAudio, transform.position);

        GameObject.Instantiate(BulletBoom, transform.position, transform.rotation);
        Destroy(this.gameObject);
    }

所有回复
发表回复
你还没有登录,请先 登录或 注册!