Error getting Unity object from Web Player for SendMessage

This is in Unity 4.

The following code gives me: Object # has no method ‘getObjectById’

function GetUnity() {
    if (typeof unityObject != "undefined") {
        return unityObject.getObjectById("unityPlayer");
    }
    return null;
}

Did something change in the new version? unityObject only provides javaInstallDone.

getObjectById is from UnityObject.js. Unity 4.0 ships with an updated JS hosting script called UnityObject2.js. The documentation describes a getUnity() function.