Topic: How to Edit Challenge mode text box.

I'm pretty happy how the text box functions in trials and tells the player how to perform the challenges but i dont seem to have any idea how to visually edit the look of the box or its font to fit my games aesthetic.
any tutorials i could look into or any tips about this?

Share

Thumbs up Thumbs down

Re: How to Edit Challenge mode text box.

The UI part of the challenges is all written under OnGUI on file DefaultChallengeModeGUI.cs

You can try changing how it behaves by allocating some of the variables from ChallengeMode.cs into UI elements.


I know the video doesn't touch on this topic in particular, but just in case I'll leave a link to the video tutorial here:
https://youtu.be/BnNyIl9zwvc?si=y1okP7T … &t=446

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.

Re: How to Edit Challenge mode text box.

Hello,

I customized and Challenge mode text box with this code. I hope this can help you and others.


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UFE3D;


using UnityEngine.UI;

public class DefaultChallengeModeGUI: ChallengeMode {
    public void OnGUI()
    { 
        EngineManager.instance.FindChallengeBox(); 
        if (EngineManager.Logs_initialized) Debug.Log($"{nameof(EngineManager.instance.FindChallengeBox)} in {nameof(DefaultChallengeModeGUI)} GameBite");


        if (!complete && !UFE.config.lockInputs && !UFE.config.lockMovements)
        {

            GUI.Box(new Rect(2000, 100, 250, 400), UFE.GetChallenge(currentChallenge).challengeName);
            GUI.BeginGroup(new Rect(3000, 130, 300, 400));
            {
                if (UFE.GetChallenge(currentChallenge).description == "%list%")
                {
                    string newDesc = "";
                    int currAction = 0;
                    foreach (ActionSequence actionSeq in challengeActions)
                    {
                        string moveName = actionSeq.specialMove.moveName;
                        if (currentAction > currAction) moveName += " (DONE)";

                        newDesc += moveName + "\n";
                        currAction++;
                    }
                    GUILayout.Label(newDesc);
                }
                else
                { 
                    EngineManager.instance.CustomSettings(currentChallenge); 
                    if (EngineManager.Logs_initialized) Debug.Log($"{nameof(EngineManager.instance.CustomSettings)} in {nameof(DefaultChallengeModeGUI)} GameBite");

            }
            GUI.EndGroup();


                if (GUI.Button(new Rect(Screen.width - 12000, 50, 70, 30), "Next Task"))
            {
                currentAction = challengeActions.Count;
                testChallenge();
            }
        
        }
    }
    }

    /*
    protected override void startNextChallenge()
    {
        int selectedStage = 0;
        if (currentChallenge == 0) selectedStage = 1; // First challenge = 0
        UFE.SetStage(UFE.config.stages[selectedStage]);
        base.startNextChallenge();
    }*/
}

Share

Thumbs up +1 Thumbs down