The new VideoPlayer feature in Unity 5.6 allows you to import and play videos without converting them to another format and attaching them as textures to an object (although you can still attach the videos to objects). You can add a videoplayer by going to GameObject --> Video --> Video Player.
This adds a VideoPlayer component to an empty object, as shown to the left. You can attach a video clip, add audio sources, change playback speed, and even add mesh renderers to play videos on curves and meshes.
Using scripts to manipulate videos is easier with the introduction of the Video Player feature. First of all, you need to import the UnityEngine.Video library, and then declare the GameObject which has the video, and its Video Player component itself:
Next, in your Start() function, you need to assign the two variables you declared above to the GameObject and its Video Player component.
You can now easily manipulate the video by accessing the class and methods of videofile. Here are some examples of commands:
You can learn more about the Video Player and its functions and methods here
This post notes the code you need to write to create your Start and Exit scenes for your game. The concept is simple. You'll need to attach buttons for every action, and link them via script. When clicked, the buttons need to open different scenes. For the Quit button, you need to quit the application.
To start, create both scenes and add your buttons. The image below is a very basic example of an exit scene with two buttons placed together in a panel (UI).
To write your exit script, create an empty object and attach a new script to it, your quitting script. For this script, remove Start() and Update() functions, and add your own function to quit the application:
Inside your function, use the Application.Quit() method, which will close the game.
Click on your button in Scene mode, and in the OnClick section, click on + and choose the empty object earlier having the script attached. Next to it, choose your exit script and your exit function. The OnClick section should look like the image shown to the left, with the exit.QuitGame function selected.
Do the same thing for your start scene. For the start scene, you need to use the SceneManager.LoadScene() method to change scenes. You need to import the UnityEngine.SceneManagement library. As before, remove all functions, and add your own function. In this case, it is LevelManager(name), with name being an argument for the scene you want to switch to.
Create a new object in the Start scene and attach this script to it. Again, add a reference to this function in the OnClick section of your button. In the text box appearing below your chosen function, enter the name of your scene. An example is shown to the left. In the text box, the word "Start" refers to a scene named "Start". Upon clicking the button, Unity will take you to this scene.
This post is meant for all those who have a Github repository containing the code for a website, and have purchased a domain name via GoDaddy, but not the hosting, and want to use the hosting of Github Pages to serve their website. Or in other words, host your website for free using Github Pages.
The post shows how to link your Github Project Repository to a domain you purchased on GoDaddy. Essentially, this means that if you visit your GoDaddy domain, you will see the code of the Github Repository as shown on its gh-pages site, but with your own domain.
Although the demonstration is for GoDaddy, the steps below can be applied to any other web registrar as well.
Thinking differently since 2000
Two roads diverged in a wood, and I--