Monday, August 31, 2015

New tool for making music.

I downloaded LMMS and started playing with it. It's a great little free program that let's you make music.

Their sample instruments have a pretty good sound and you can click to add notes to the measures or you can open the piano tuner and set your own notes.

Thursday, August 20, 2015

Utah Unity User Group meetup

I started a Unity User group since there was not one in Utah. Our first meeting was 8/13/2015 and I have to say it seems like a success. I've had several people reach out to me saying they started working on game dev with Unity.

I began with a presentation on UI in Unity. Then we opened the group for showing their own projects and games to each other. I think it was a good turnout with more than 30 people. There were 5 or 6 games shown and people could ask questions how they did things with it. I feel like people got something out of the meeting even though the pizza sponsor fell through.

Scene for showing different Canvas display modes.

Destiny Mock Up.

FF7 Menu Mock up for demoing Unity UI.

Group showing off their games.

Another shot of the group.

Thursday, June 25, 2015

Things I've learned about networking in Unity 5.1

In Unity 5.1 networking features were added.

In order to use them you'll want to create an empty game object. Next you will add a Network Manager component along with a network HUD component.
For any objects that you want to interact with and have loaded via network like a player you want to add the component Network identity.

This component has two flags, Server Only or Local Player Authority. Server only will have the object only live on the server. Local Player authority will have it be client only.

In your script you want to add a Using statement for Unity.Networking. Next you will want your class to inherit from NetworkBehaviour instead of MonoBehavior.
In your Update method you can have a check for if (!isLocalPlayer){return;} which will exit the update method if it's not the local player. This will prevent you from playing as multiple characters at the same time.

Thursday, June 4, 2015

How to play music in Unity

I added some music to the PH test because I was tired of not having music.

Here is my pause script which switches the tracks playing. The Main Camera object has an AudioSource object (added when you drag and drop an audio file onto it).

using UnityEngine;
using System.Collections;

public class Pause : MonoBehaviour {
    bool paused = false;
    GameObject pauseCanvas, camera;
    AudioSource audioSource;
    public AudioClip pauseClip, musicClip;
    // Use this for initialization
    void Start () {
        pauseCanvas = GameObject.FindGameObjectWithTag("PauseCanvas");
        camera = GameObject.FindGameObjectWithTag("MainCamera");
        audioSource = camera.GetComponentInChildren<AudioSource>();
    // Update is called once per frame
    void Update () {
        if (Input.GetButtonDown("Cancel")) {
            paused = !paused;
            if (paused) {
                Time.timeScale = 0;
                audioSource.clip = pauseClip;
            else {
                Time.timeScale = 1;
                audioSource.clip = musicClip;

Tuesday, May 26, 2015

Sample website

I've created an Azure website for uploading prototypes to.

It's good for hosting things out there and gave me some practice with MVC.

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).