I am trying to add short video to the scene by importing the video in .ogv file format, adding it to the material of a plane and attaching the .js script to it, which has the line “renderer.material.mainTexture.Play();”. Everything works correctly and the video is playing. But when I try to build it as .apk file, it gives the error: ‘Play’ is not a member of ‘UnityEngine.Texture’. Help?
Please use the search function, this has been asked before, have a look @ Playing a movie texture. No .Play() definition in UnityEngine.Texture class (Documentation seems to think there should be) which was answered in 2012.
Also make sure you’re using Pro/Advanced as indicated in documentation. You did not specify what version you are using.
From the docs:
Note: This is a Pro/Advanced feature only. 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.
I have Unity Pro. I rectified the script according to the link given, but for no use. It still can’t build the .apk file. On searching for the same, I found that movieTextures are not supported on Android. What other alternatives do I have for including videos in my .apk file?
Handheld.PlayFullScreenMovie should work nicely.
You need to place your video in a StreamingAssets folder and provide the path to PlayFullScreenMovie.