Maintain variable values while changing levels

How do I maintain the values of my variables when I am changing from one scene to the next? Like with character health, everything gets restarted, even when I use DontDestroyOnLoad(random script). What are some good techniques that I can use?

Have you tried creating a gameobject, attaching a controller script that manages player health and such on it, then calling DontDestroyOnLoad on the gameobject upon Awake like so:

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {

    void Awake() {
        DontDestroyOnLoad(transform.gameObject);
    }
}