c# - 如何在 Unity 中更改其他玩家的相机?
问题描述
我正在使用带有 Photon 的 Unity3D,我需要模糊另一个玩家的相机。
有谁知道我该怎么做?
解决方案
将 PhotonView 脚本添加到相机对象和模糊相机对象的脚本。然后在下面创建脚本并将其添加到相机对象中按空格键为对手创建相机模糊效果。
public class PunCamera : MonoBehaviour
{
private void Update()
{
if(Input.GetKeyDown(KeyCode.Space))
{
OtherPlayerBlur();
}
}
public void OtherPlayerBlur()
{
//Get the PhotonView in the camera object and call the RPC
var _photonView = this.GetComponent<PhotonView>();
_photonView.RPC("PunCameraBlur", PhotonTarget.Others);
}
[PunRPC]
private void PunCameraBlur()
{
// Camera Blur Method Call
}
}
推荐阅读
- python - 如果组在指定列表中,如何根据组对组的值求和?
- javascript - 使用带有firestore的异步函数返回未定义的数组
- c - GCC 优化魔法
- c# - C# Entity Framework 代码首先无法将相关数据添加到对象列表中
- mysql - 任何自动化 mySQL 查询验证的好工具?
- html - 如何使一些图像显示在带有文本的 div 下?
- vmware-clarity - 如何使用清晰的库迁移到 Angular 10?
- python - 如何将多个 .pcd 文件组合成一个包含点云数据(python)的 .pcd 文件?
- r - 在 R 中计算月份数
- apollo-server - 如何在 React Relay 和 Apollo Server 中使用持久查询