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

您所在的位置:网站首页 笔记本摄像头没显示画面 unity中 ump打包后其他电脑运行摄像头无画面

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

2024-06-22 04:42| 来源: 网络整理| 查看: 265

问题: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这个脚本的问题



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3