相关疑难解决方法(0)

使用新的Unity VideoPlayer和VideoClip API播放视频

在Unity 5.6.0b1发布之后, MovieTexture最终被弃用,现在发布了在桌面和移动设备上播放视频的新API.

如果需要, VideoPlayer VideoClip可用于播放视频并检索每个帧的纹理.

我已经设法让视频正常工作但是却没有从Windows 10的编辑器那里得到音频.任何人都知道为什么音频没有播放?

//Raw Image to Show Video Images [Assign from the Editor]
public RawImage image;
//Video To Play [Assign from the Editor]
public VideoClip videoToPlay;

private VideoPlayer videoPlayer;
private VideoSource videoSource;

//Audio
private AudioSource audioSource;

// Use this for initialization
void Start()
{
    Application.runInBackground = true;
    StartCoroutine(playVideo());
}

IEnumerator playVideo()
{
    //Add VideoPlayer to the GameObject
    videoPlayer = gameObject.AddComponent<VideoPlayer>();

    //Add AudioSource
    audioSource = gameObject.AddComponent<AudioSource>();

    //Disable Play on Awake for both Video …
Run Code Online (Sandbox Code Playgroud)

c# unity-game-engine unity5

35
推荐指数
2
解决办法
6万
查看次数

如何使脚本以统一的简单方式等待/睡眠

如何在TextUI.text = ....睡眠功能之间放置,每个短语之间等待3秒?

public Text GuessUI;
public Text TextUI;

[...truncated...]

TextUI.text = "Welcome to Number Wizard!";
TextUI.text = ("The highest number you can pick is " + max);
TextUI.text = ("The lowest number you can pick is " + min);
Run Code Online (Sandbox Code Playgroud)

我已经尝试了各种各样的东西,但没有奏效,这样:

TextUI.text = "Welcome to Number Wizard!";
yield WaitForSeconds (3);
TextUI.text = ("The highest number you can pick is " + max);
yield WaitForSeconds (3);
TextUI.text = ("The lowest number you can pick is " + min);
Run Code Online (Sandbox Code Playgroud)

在bash中将是: …

c# sleep wait monodevelop unity-game-engine

22
推荐指数
3
解决办法
8万
查看次数

标签 统计

c# ×2

unity-game-engine ×2

monodevelop ×1

sleep ×1

unity5 ×1

wait ×1