Irrelevant Pixel
  • Introduction / Foreword
  • ↘️Integrating Menu into your game
    • Add to your project
    • Maps and Modes
    • Your Game Instance
    • Play in your Level
    • Turn ON Enhanced Input
    • Mouse functionality
    • Integration completed
  • Getting to know how to use it
    • Creating Page for Options
    • Selector
    • Slider
    • Toggle
    • Keybinder
      • Duplicating Keys
    • Stylizing Interactive Widgets
    • Save your Options
    • End of the Basic Usage Manual
  • Advancing into Internal Structure
    • Core Concepts
    • Page-related things
    • Aspect Ratios + Resolutions
    • Graphics 'Overall Quality'
    • Deeper into (C)Stylizing
    • deleting Dev.Tool
Powered by GitBook
On this page
  • Now, when you have created your Page, we can finally start playing the main thing of this entire product: Modular Options.
  • Now lets make it do something.
  1. Getting to know how to use it

Selector

Modular Option Widget 1 of 4

Last updated 9 months ago

Now, when you have created your Page, we can finally start playing the main thing of this entire product: Modular Options.

And we begin with probably the most valuable and code-heavy of all four - Option Selector.


Open the Page asset you've created in the previous chapter. In the widget Palette, at the User Created category, find WBP Modular Selector, and just throw it at Vertical Box you've placed recently on that Named Slot:

Now we will focus on the 'User Specified' area, where you specify each field you are interested in:

  • Selector Type: just change type of your widget when you want to.

  • Array Of Options: it is a simple array of Texts, most of the time you fill it right there, but sometimes you leave it empty and untouched and specify your options inside Blueprint with dedicated function and it will be filled at the runtime.

  • Default Value: since this Modular Option is integer-based, all you have to handle when the Option is switched - is its index(Int). So just fill this field with the index number (if incorrect - Reset to Defaults Button will do nothing to such an Option).

  • Custom Default Value: sometimes you don't know what the default value should be, and you have to get it at runtime programmatically. For such situations, this checkbox exists. Once it's checked, - Default Value checkbox above will be ignored, and you'll have to handle it via Blueprint (just ignore for now, we'll get to that later).

  • Option Name: that will be displayed to the player.

  • Option Tool Tip: will be shown if the mouse hovered over the Option Name. This functionality is completely raw and untouched, it is presumed that you'll implement it your own way (if even you think that it is necessary in the first place), since there are plenty of cool and very different ways you can possibly do that.

  • Auto Apply: i think this one is pretty self-explanatory.

For this example, I filled it with something like that:

And you can see that Widget part works in game:


Now lets make it do something.

Scroll down to the Events section, and there click at Option Selected:

This is the main Event Dispatcher for this widget.

You probably have plenty of useful applications that make sense for such a widget, but in my case for sake of example I'll just stick with a simple Print String functions:

And in game it truly printing once button clicked! Isn't that a miracle?!

Besides, since I specified correct Default Value, clicking Reset to Defaults button also performs correctly.

Okay, now we have a little problem. As you might notice, when you launch the game, Selector is not selected any option, it means it is deselected and started at -1. To deal with that, On Construct(I prefer On Pre-Construct) you must specify which Option at what index you want to be selected.

To do that, go to your Page's Pre-Construct Sequence node which you left empty in the previous chapter, pull your Selector variable there, and run a single function from it:

Now when you launch the game, you can see Print String message of this Option's index once the game appears on the screen, and the widget part (button, menu, toggle, slider or whatever) is already set as well.

In some cases however, you don't want the Option to perform its functional part, you just want 'silently' set the widget part. For such purposes exists nearly identical function:

As you can see, there is no Print String message on startup anymore, but your widget part is selected.

And by the way, those are general-purpose functions, which could be used all over the place, not necessarily for running them just on startup.

Now lets quickly cover up the second Event Dispatcher of this Widget:

I am implementing it simply like so:

Do not forget to check Custom Default Value checkbox in order it to work!

Go and try press Reset to Defaults button now.

The last thing that remained to be shown is Auto-Apply functionality. Just uncheck it and go play with it in game.


That's enough for now. All the basic functionalities of the Option Selector are covered.

Page cover image