Tuesday, April 28, 2015

Load levels using new UI system (Unity 5)

I recently discovered how to load levels using the new UI system in Unity 5.

  • Add a canvas to your scene.
  • Add a button to your canvas.
  • Create a new script as follows:


  • using UnityEngine;
  • using System.Collections;
  • public class ButtonNextLevel : MonoBehaviour
  • {
  • public void NextLevelButton(int index)
  • {
  • Application.LoadLevel(index);
  • }
  • public void NextLevelButton(string levelName)
  • {
  • Application.LoadLevel(levelName);
  • }
  • }
    • Create a new empty game object and attach the script.
    • On the Button (Script) component of the button, select the empty game object under the On Click() box.
    • Select the ButtonnextLevel.NextLevelButton (string) method in the upper right dropdown button.
    • Enter the name of the level you want to load (must be a scene in the build settings). 

    Wednesday, January 28, 2015

    How to get your Unity game running on a retail PS Vita.

    1. Buy a Vita.

    2. Apply for Developer Registration and publisher license here:
     https://psm.playstation.net/portal/en/index.html#register/signin

    3. Build your project in Unity. They have a custom unity editor designed for PSM here:
     https://psm.playstation.net/static/general/all/en/sdk_assets.html
    This page is pretty good and has some of the steps needed. It seems they update the editor pretty frequently. I think the next jump will be to Unity 5.0 according to some forum posts.
    4. Download the PSM Tool set from the same page.
    5. On your PS Vita download the "PSM Development Assistant for Unity" from the PS Store.
    6. Plugin your Vita to your computer and run the PSM Dev Assistant. you will need your publisher license in order for it to fully setup.
    7. In Unity open the build menu under File and select PSM.





    8. Open the Publishing Utility and enter some of the Metadata values in the first tab visible.


    9. You'll need to go to Key Management and hit the Key with the + icon next to it to create a key. Honestly, I don't know much of what I was doing here. I just put in what looked like required fields.


    10. Hit Build and Run. If there were no errors, you should see a progress bar appear saying it's building and deploying to the PSM device. On your vita there should be an install progress bar. Then it will launch the game.

    Running on my retail PS Vita
    My game doesn't really have a quit feature implemented yet so I have to close the app completely to stop it. The games that have been loaded will appear in a list when you launch the PSM for Unity app again on your vita so you can show your friends.