如何在Gear Vr中检测水龙头以进行操作
我使用Unity 5和C#编程语言
我的尝试
我在untiy3d论坛上阅读答案
他们都没有对我有用
http://forum.unity3d.com/threads/samsung-gear-vr-detect-tap-swipe.298346/
有什么建议
我试图将Game Center集成到我的Unity 5项目中,并且遇到了麻烦。似乎在iOS设备上启动游戏时,身份验证正常,出现通知,但页首横幅按钮不起作用,当我点击GC按钮时什么也没有发生。我将“ ShowLeaderboard()”的启动分配给了GC按钮。请看下面我使用的脚本。希望为我的问题找到解决方案。先感谢您。
using UnityEngine;
using UnityEngine.SocialPlatforms;
using UnityEngine.SocialPlatforms.GameCenter;
using System.Collections;
public class GameCenter : MonoBehaviour {
public string leaderboardID = "mygameleaderboard";
void Start () {
AuthenticateToGameCenter();
}
private bool isAuthenticatedToGameCenter;
public static void AuthenticateToGameCenter() {
#if UNITY_IPHONE
Social.localUser.Authenticate(success => {
if (success) {
Debug.Log("Authentication successful");
} else {
Debug.Log("Authentication failed");
}
});
#endif
}
public static void ReportScore(long score, string leaderboardID) {
#if UNITY_IPHONE
Debug.Log("Reporting score " + score + " on leaderboard " + leaderboardID);
Social.ReportScore(score, leaderboardID, …Run Code Online (Sandbox Code Playgroud) c# game-engine unity-game-engine game-center-leaderboard unity5
我完成了Unity的roll-a-ball教程,它运行正常.我换了几种材料让它看起来更好.我还添加了一个C#脚本,当玩家从地面掉下来时应重启该级别(我禁用了墙壁).我使用的是Unity 5.5.
但当我离开边缘并重新启动时,它看起来像这样:
在编辑器加载时打开统一后,它有时看起来像这样几秒钟.
这是脚本:
using UnityEngine;
using System.Collections;
public class DeathTrigger : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter (Collider other)
{
if (other.gameObject.CompareTag("Player"))
Application.LoadLevel(Application.loadedLevel);
}
}
Run Code Online (Sandbox Code Playgroud)
关于是什么导致这个的任何想法?
这篇文章中指出,使用新的Unity VideoPlayer和VideoClip API播放视频时,人们可以“根据需要检索每一帧的纹理”
请问将当前帧作为Texture2D的正确方法是什么?
编辑:
回答之后,我这样做了,但是不起作用:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
public class AverageColorFromTexture : MonoBehaviour {
public VideoClip videoToPlay;
public Light lSource;
private Color targetColor;
private VideoPlayer videoPlayer;
private VideoSource videoSource;
private Renderer rend;
private Texture tex;
private AudioSource audioSource;
void Start()
{
Application.runInBackground = true;
StartCoroutine(playVideo());
}
IEnumerator playVideo()
{
rend = GetComponent<Renderer>();
videoPlayer = gameObject.AddComponent<VideoPlayer>();
audioSource = gameObject.AddComponent<AudioSource>();
//Disable Play on Awake for both Video and Audio
videoPlayer.playOnAwake = false;
audioSource.playOnAwake = …Run Code Online (Sandbox Code Playgroud) 我在控制台屏幕上收到此错误,除非我修复它,否则我无法播放该项目.
有人可以解释它以及如何解决它?我无法在线找到与此错误相关的任何内容.
我今天刚开始学习团结.每次我打开它都告诉我Mono.exe停止工作,但我不知道它是否与断言错误有关,我也卸载它然后重新安装它仍然没有改变.
cube1.name = string.Format("Terrain_{0}_{1}",
(int)Terrain.activeTerrain.transform.position.x + tilePositionInLocalSpace.x,
(int)Terrain.activeTerrain.transform.position.z + tilePositionInLocalSpace.y);
Run Code Online (Sandbox Code Playgroud)
试图把它投下来,int但没有太大变化.每个多维数据集的名称仍然是例如:Terrain_6.5_5.5.但我想要这个名字Terrain_6_5.
tilePositionInLocalSpace是vector3类型,x都是float类型.
我在某处读到我不应该在游戏引擎的 Update() 方法中创建任何新对象实例,因为这会导致唤醒垃圾收集器并降低性能,但有时我在一些教程中看到他们使用 new 关键字unity Update() 方法!这个可以吗?团结会以某种方式处理这个问题,还是不?
我有一个关于在编写Unity脚本时gameObject继承的用法的问题MonoBehaviour.
在一些教程中,例如,为了制作缩放健康栏,我们检索健康栏的原始比例,如下所示:
originalScale = gameObject.transform.localScale.x;
Run Code Online (Sandbox Code Playgroud)
我玩弄了一下这一点,并认为,因为我正在改变我正在操纵的物体,我也可以使用this:
originalScale = this.transform.localScale.x;
Run Code Online (Sandbox Code Playgroud)
在Unity中,这两个是否总是等价的(至少在实现时MonoBehaviour)?是否只是更常见的使用,gameObject以便明确我们所指的是什么?
当你第一次运行Unity时,它就有一个区域灯就像太阳一样的场景,相机是一个很好的阴影,可以让你清楚地看到你周围.
我不小心改变了我的主摄像头上的设置,它已经停留在那里,并且是纯蓝色.如何恢复原始相机设置?
[学习英语]我没有找到使用RGBToHSV()的Unity示例.我正在尝试不同的代码组合,但我不知道如何正确使用RGBToHSV().我尝试只使用该功能但不起作用.在Unity文档和论坛中没有示例.我是否需要先为该功能添加Color?我也尝试myColor =到Color.RGBToHSV(...)但是没有用.如何使用RGBToHSV()函数的正确方法?
// Declaration
public float hue { get; set; }
float S, V;
Color.RGBToHSV (actualRGBColor, out hue, out S, out V);
Run Code Online (Sandbox Code Playgroud)
但是错误:属性或索引器GetSetColor.hue可能不会作为ref' orout'参数传递.
如何在Unity c#中正确使用Color.RGBToHSV()?