// Set reference pointers to the correct objects.
    public void Start()
    {
        // Get the main object reference and ensure core scripts are added.
        GameObject mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];

        if(GameObject.FindGameObjectsWithTag("MainObject").Length > 1){
            GameObject[] mainObjectList = GameObject.FindGameObjectsWithTag("MainObject");
            for(int i = 0; i < mainObjectList.Length; ++i){
                if(mainObjectList[i].GetComponent<GameStateManager>().objectSaved){
                    mainObject = mainObjectList[i];
                }
            }
        }
        gameStateManagerRef = mainObject.GetComponent<GameStateManager>();
        gameStateManagerRef.EnsureCoreScriptsAdded();

        // Get the global variables reference.
        GameObject gVar = GameObject.FindGameObjectsWithTag("globalVariables")[0];
        globalVariables = gVar.GetComponent<GVariables>();
    }
    void Start()
    {
        // the following is now needed due to the prefab of 'MainObject'
        GameObject mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];
        gameStateManagerRef = mainObject.GetComponent<GameStateManager>();
        gameStateManagerRef.EnsureCoreScriptsAdded();
        screenManagerRef = mainObject.GetComponent<ScreenManager>();
        soundManagerRef = mainObject.GetComponent<SoundManager>();
        characterControllerRef = GameObject.FindGameObjectWithTag("Player").GetComponent<TWCharacterController>();
        mainCamera = GameObject.FindGameObjectWithTag("MainCamera");

        // get a reference to the tear manager
        tearManager = GameObject.FindGameObjectWithTag("TearManager").GetComponent<TearManager>();

        // get a reference to fold
        fold = GameObject.FindGameObjectWithTag("FoldObject").GetComponent<Fold>();

        LvlGoalCoreRef = GameObject.FindGameObjectWithTag("GoalCore").GetComponent<LvlGoalCore>();

        // Get the global variables reference.
        GameObject gVar = GameObject.FindGameObjectsWithTag("globalVariables")[0];
        globalVariables = gVar.GetComponent<GVariables>();

        // if the goal is on the backside move necessary components by offset to be at correct location.
        if(goalOnBackSide){
            // change the box collider on the goal core
            Vector3 GoalCollider = this.gameObject.GetComponent<BoxCollider>().center;
            GoalCollider = new Vector3(GoalCollider.x, GoalCollider.y, GoalCollider.z + (offset*2f));
            this.gameObject.GetComponent<BoxCollider>().center = GoalCollider;

            // change the graphics child object position
            Vector3 GraphicTrans = transform.FindChild("Graphics").transform.position;
            GraphicTrans = new Vector3(GraphicTrans.x, GraphicTrans.y, GraphicTrans.z + offset);
            transform.FindChild("Graphics").transform.position = GraphicTrans;

            // change the goal core child object.
            Vector3 GoalCoreTrans = transform.FindChild("GoalCore").transform.position;
            GoalCoreTrans = new Vector3(GoalCoreTrans.x, GoalCoreTrans.y, GoalCoreTrans.z + offset);
            transform.FindChild("GoalCore").transform.position = GoalCoreTrans;
        }
        buttonCamera = GameObject.FindGameObjectWithTag("button");
    }
    // Use this for initialization.
    public override void Start()
    {
        base.Start();
        escDown = false;
        GameObject mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];
        gameStateManagerRef = mainObject.GetComponent<GameStateManager>();
        if(GameObject.FindGameObjectsWithTag("MainObject").Length > 1){
            GameObject[] mainObjectList = GameObject.FindGameObjectsWithTag("MainObject");
            for(int i = 0; i < mainObjectList.Length; ++i){
                if(mainObjectList[i].GetComponent<GameStateManager>().objectSaved){
                    mainObject = mainObjectList[i];
                    gameStateManagerRef = mainObject.GetComponent<GameStateManager>();
                }
            }
        }

        // Get the global variables reference.
        GameObject gVar = GameObject.FindGameObjectsWithTag("globalVariables")[0];
        globalVariables = gVar.GetComponent<GVariables>();

        if(IntToCharDict == null){
            SetupDictionary();
        }

        BUTTON_DELTA = new Vector2(60, 60);
        NUM_COLS = 10;
        NUM_ROWS = 3;

        START_POS = new Vector2(
                START_POS.x / 2f - (((BUTTON_WIDTH + (BUTTON_DELTA.x - BUTTON_WIDTH)) * NUM_COLS) / 2f),
                START_POS.y / 2f);

        scoreString = ENTER_SCORE_STRING;
        nameString = ENTER_NAME_STRING;
        currString = nameString;

        CreateGUIButtons();
        CreateGUIBox();

        gameStateManagerRef.gameObject.GetComponent<InputManager>().enabled = false;
        gameStateManagerRef.gameObject.GetComponent<AnimationManager>().enabled = false;

        endLevelObject = GameObject.FindGameObjectWithTag("EndLevelObject");
        levelCompleteTextObject = GameObject.FindGameObjectWithTag("LevelCompleteText");
        swipeToContinueTextObject = GameObject.FindGameObjectWithTag("SwipeToContinueText");

        blackFadeObject = GameObject.FindGameObjectWithTag("BlackFade");
        blackFadeObject.GetComponent<GUITexture>().enabled = false;
        blackFadeObject.GetComponent<Camera>().enabled = true;
        blackFadeObject.GetComponent<GUILayer>().enabled = true;

        blackFadeAlpha = 0;
    }