Topic: Debugger Position Script

If you need a script to control the position of your debugger you can use this.

 #if UNITY_EDITOR
using UnityEngine;
using UFE3D;

public class UFE_2DebuggerPositionHandlerScript : MonoBehaviour
{
    //I recommend deleting the object this script is attached to before creating a build of your game

    private RectTransform player1DebuggerRectTransform;
    public Vector3 player1DebuggerPosition;

    private RectTransform player2DebuggerRectTransform;
    public Vector3 player2DebuggerPosition;

    // Update is called once per frame
    void Update()
    {
        switch (UFE.config.debugOptions.debugMode)
        {
            case true:
                switch (UFE.config.debugOptions.trainingModeDebugger)
                {
                    case true:
                        switch (UFE.gameMode)
                        {
                            case GameMode.TrainingRoom:
                                if (UFE.p1ControlsScript != null
                                    && UFE.p2ControlsScript != null)
                                {
                                    if (player1DebuggerRectTransform == null
                                        && player2DebuggerRectTransform == null)
                                    {
                                        player1DebuggerRectTransform = GameObject.Find("Debugger1").GetComponent<RectTransform>();

                                        player2DebuggerRectTransform = GameObject.Find("Debugger2").GetComponent<RectTransform>();
                                    }
                                    else
                                    {
                                        player1DebuggerRectTransform.anchoredPosition = player1DebuggerPosition;

                                        player2DebuggerRectTransform.anchoredPosition = player2DebuggerPosition;
                                    }
                                }
                                break;
                        }
                        break;

                    case false:
                        if (UFE.p1ControlsScript != null
                            && UFE.p2ControlsScript != null)
                        {
                            if (player1DebuggerRectTransform == null
                                && player2DebuggerRectTransform == null)
                            {
                                player1DebuggerRectTransform = GameObject.Find("Debugger1").GetComponent<RectTransform>();

                                player2DebuggerRectTransform = GameObject.Find("Debugger2").GetComponent<RectTransform>();
                            }
                            else
                            {
                                player1DebuggerRectTransform.anchoredPosition = player1DebuggerPosition;

                                player2DebuggerRectTransform.anchoredPosition = player2DebuggerPosition;
                            }
                        }
                        break;
                }
                break;              
        }     
    }
}
#endif

Share

Thumbs up +1 Thumbs down