unity中 ump打包后其他电脑运行摄像头无画面

问题:unity使用ump插件连接大华摄像头,生成的项目在本机运行正常,但换了电脑之后运行摄像头无画面

原因:导入Ump插件后,在UniversalMediaPlayer——>Resources文件夹下有一个UMPSettings

这个是用来配置VLC播放器的 但是它找的是工程绝对路径下的dll文件。所以要想解决这个问题就要更改获取dll的文件路径。

解决方案:

找到 UniversalMediaPlayer ==》Editor==》UMPPostBuilds这个脚本

把BuildWindowsPlayer64这个方法修改为如下:

public static void BuildWindowsPlayer64(string path, UMPSettings settings)
{
string buildPath = Path.GetDirectoryName(path);
string dataPath = buildPath + "/" + Path.GetFileNameWithoutExtension(path) + "_Data";

if (!string.IsNullOrEmpty(buildPath))
{
if (!settings.UseExternalLibraries)
{
CopyPlugins(settings.AssetPath + "/Plugins/Win/x86_64/plugins/", dataPath + "/Plugins/plugins/");
string[] files = Directory.GetFiles(dataPath + "/Plugins/x86_64/");
foreach (string str in files)
{
string file = Path.GetFileName(str);
Debug.LogError(file);
File.Copy(str, dataPath + "/Plugins/" + file);
}
Directory.Delete(dataPath + "/Plugins/x86_64/", true);
}
else
{
if (File.Exists(dataPath + "/Plugins/" + UMPSettings.LIB_VLC_NAME + ".dll"))
File.Delete(dataPath + "/Plugins/" + UMPSettings.LIB_VLC_NAME + ".dll");

if (File.Exists(dataPath + "/Plugins/" + UMPSettings.LIB_VLC_CORE_NAME + ".dll"))
File.Delete(dataPath + "/Plugins/" + UMPSettings.LIB_VLC_CORE_NAME + ".dll");
}
}
Debug.Log("Standalone Windows (x86_x64) build is completed: " + path);
}

修改后打包就可以了

这里有两个注意事项:

1.存放exe包的文件夹下不能存在中文名称

2.导入的UMP插件UniversalMediaPlayer一定要在Assets文件夹下

还有一点需要注意的是打开脚本方式用选中项目然后右键打开c#项目的方式去打开,我之前通过双击某个脚本去打开项目会出现在项目中找不到UMPPostBuilds这个脚本的问题

posted @   嘿,阿然  阅读(1833)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示