我正在开发一个结合了Vuforia ImageTarget和VideoPlayback的项目.我有'N'个目标,它有相应的视频.对于某些imageTargets,视频会被翻转.我找不到任何解决这个问题的方法.这是我的VideoPlaybackRenderer
int videoPlaybackTextureID[] = new int[VideoPlayback.NUM_TARGETS];
// Keyframe and icon rendering specific
private int keyframeShaderID = 0;
private int keyframeVertexHandle = 0;
private int keyframeNormalHandle = 0;
private int keyframeTexCoordHandle = 0;
private int keyframeMVPMatrixHandle = 0;
private int keyframeTexSampler2DHandle = 0;
// We cannot use the default texture coordinates of the quad since these
// will change depending on the video itself
private float videoQuadTextureCoords[] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, };
private Float …Run Code Online (Sandbox Code Playgroud) 在我正在处理的项目中,StreamingAssets 目录中有两个 json 文件。处理它们的脚本在独立 PC 构建中完美运行,但在 WebGL 构建中根本不起作用。
我收到“找不到文件!” 根据脚本发送消息:
else if (!File.Exists (filePath))
{
Debug.LogError ("Cannot find file!");
}
Run Code Online (Sandbox Code Playgroud)
我得到了使用 WWW 类的答案,如 Unity Technologies 站点上的脚本 API 中所述,地址为:https ://docs.unity3d.com/ScriptReference/Application-streamingAssetsPath.html
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
public string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "MyFile");
public string result = "";
IEnumerator Example() {
if (filePath.Contains("://")) {
WWW www = new WWW(filePath);
yield return www;
result = www.text;
} else
result = System.IO.File.ReadAllText(filePath);
}
}
Run Code Online (Sandbox Code Playgroud)
我很乐意这样做,但我在编码方面太新了,我需要一些解释。我现在的第一个问题是:该行中的“我的文件”字符串是什么
public string filePath …Run Code Online (Sandbox Code Playgroud)