Adding New Settings
Last updated
Was this helpful?
Last updated
Was this helpful?
The Settings menu uses a single generic widget for all entries: W_Settings_Entry. This widget has the capability of supporting 4 different settings:
Single Button Entry
Double Button Entry (Increase/Decrease)
Drop-down Entry
Slider Entry
We will use the Double Button style to create a new setting entry for toggling on/off VSync.
Start by heading into the generic setting entry widget: W_Settings_Entry:
Go into the Event Graph and head inside the collapsed Initialization graph:
Add a new tag for your setting. For this example, I've added SoulslikeFramework.Settings.VSync:
Now, we'll set the entry type to Double Button and ensure that the new setting is retrieved from the GameUserSettings:
Go back into the Event Graph and go into the Double Button Settings node:
Add your new setting tag to the Switch node:
Then, when the increase button is pressed, we want to basically toggle the setting on/off. We can achieve this like so:
Do not forget to the same process for the decrease button.
Next, we want to add a new entry to our Settings widget. Head into W_Settings. Add a new W_Settings_Entry widget to the vertical box:
Finally, ensure that you select the correct tag for your setting and customize the display name/description for your new entry:
We will yet again use the Double Button style to create a new setting entry for toggling on/off Blood.
First of all, lets begin by adding a new flag for Blood in our custom game settings asset. Head inside PDA_CustomSettings, and add a new boolean. Ensure that it's default value is set to be True:
The custom game settings asset is stored in the Game Instance so it can easily be accessed from any class at any time.
Now, we'll need to adjust logic where blood effects are being applied. Lets start with AC_CombatManager. Adjust all of the methods that spawn blood effects following this logic:
Similarly, adjust methods in AC_AI_CombatManager for the effects on enemies.
This approach is quite simple and will disable all "hit" visual effects, even if they're not blood related. To determine if a hit effect is blood, you will need to implement your own custom logic.
Now, head inside W_Settings_Entry and into the collapsed Initialization graph. Add a new tag for your setting (SoulslikeFramework.Settings.Custom.Blood in our example):
Initialize the setting entry from our CustomSettings asset:
Next, head into the Double Button Settings collapsed graph. Add the new tag to both of the switches.
Ensure that you toggle our new boolean when increase/decrease buttons have been pressed:
Finally, lets add a new entry to our W_Settings widget. You can easily duplicate elements under the CategorySwitcher to add/remove categories.
For example, we'll place this new setting in the Gameplay Settings category which is not utilized by default.
Since we've adjusted the index count of our CategorySwitcher, we need to ensure that each category has a correct index assigned:
That's it! Now we should have our setting on a new category that we've started utilizing:
Now if we disable blood, you'll notice no effect is played upon dealing/taking damage!