How to play news in TV when i switch on, using scr

2019-03-07 06:15发布

问题:

I am new in unity3D. I need to know how can we play news in TV when i switch on using the scripting languages in Unity3D

回答1:

You might be interested in MovieTexture.

Movie Textures are animated Textures that are created from a video file. By placing a video file in your project's Assets Folder, you can import the video to be used exactly as you would use a regular Texture.

Video files are imported via Apple QuickTime. Supported file types are what your QuickTime installation can play (usually .mov, .mpg, .mpeg, .mp4, .avi, .asf). On Windows movie importing requires Quicktime to be installed.

if (Input.GetButtonDown ("Jump")) {
    if (renderer.material.mainTexture.isPlaying) {
        renderer.material.mainTexture.Pause();
    }
    else {
        renderer.material.mainTexture.Play();
    }
}

Note: This is a Pro/Advanced feature only.