Show / Hide Table of Contents

Class GUIManager

Manager for handling anything GUI related. Provides Valheim style GUI elements as well as an anchor for custom GUI prefabs.
Inheritance
System.Object
GUIManager
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Jotunn.Managers
Assembly: Jotunn.dll
Syntax
public class GUIManager : IManager

Fields

| Improve this Doc View Source

UILayer

Unity layer constant for UI objects.
Declaration
public const int UILayer = 5
Field Value
Type Description
System.Int32
| Improve this Doc View Source

ValheimButtonColorBlock

Button color block in Valheim style
Declaration
public ColorBlock ValheimButtonColorBlock
Field Value
Type Description
ColorBlock
| Improve this Doc View Source

ValheimControlResources

with default Valheim assets.
Declaration
public DefaultControls.Resources ValheimControlResources
Field Value
Type Description
DefaultControls.Resources
| Improve this Doc View Source

ValheimOrange

The default Valheim orange color.
Declaration
public Color ValheimOrange
Field Value
Type Description
Color
| Improve this Doc View Source

ValheimScrollbarHandleColorBlock

Scrollbar handle color block in default Valheim orange.
Declaration
public ColorBlock ValheimScrollbarHandleColorBlock
Field Value
Type Description
ColorBlock
| Improve this Doc View Source

ValheimToggleColorBlock

Toggle color block in Valheim style.
Declaration
public ColorBlock ValheimToggleColorBlock
Field Value
Type Description
ColorBlock

Properties

| Improve this Doc View Source

AveriaSerif

Valheim standard font normal faced.
Declaration
public Font AveriaSerif { get; }
Property Value
Type Description
Font
| Improve this Doc View Source

AveriaSerifBold

Valheims standard font bold faced.
Declaration
public Font AveriaSerifBold { get; }
Property Value
Type Description
Font
| Improve this Doc View Source

CustomGUIBack

GUI container behind Valheim's GUI elements with automatic scaling for high res displays and pixel correction. Gets rebuild at every scene change so make sure to add your custom GUI prefabs again on each scene change.
Declaration
public static GameObject CustomGUIBack { get; }
Property Value
Type Description
GameObject
| Improve this Doc View Source

CustomGUIFront

GUI container in front of Valheim's GUI elements with automatic scaling for high res displays and pixel correction. Gets rebuild at every scene change so make sure to add your custom GUI prefabs again on each scene change.
Declaration
public static GameObject CustomGUIFront { get; }
Property Value
Type Description
GameObject
| Improve this Doc View Source

Instance

Singleton instance
Declaration
public static GUIManager Instance { get; }
Property Value
Type Description
GUIManager
| Improve this Doc View Source

PixelFix

GUI container with automatic scaling for high res displays. Gets rebuild at every scene change so make sure to add your custom GUI prefabs again on each scene change.
Declaration
[Obsolete("Use CustomGUIFront or CustomGUIBack")]
public static GameObject PixelFix { get; }
Property Value
Type Description
GameObject

Methods

| Improve this Doc View Source

AddKeyHint(KeyHintConfig)

Add a KeyHintConfig to the manager.
Checks if the custom key hint is unique (i.e. the first one registered for an item).
Custom status effects are displayed in the game instead of the default KeyHints for equipped tools or weapons they are registered for.
Declaration
[Obsolete("Use KeyHintManager.AddKeyHint instead")]
public bool AddKeyHint(KeyHintConfig hintConfig)
Parameters
Type Name Description
KeyHintConfig hintConfig The custom key hint config to add.
Returns
Type Description
System.Boolean true if the custom key hint config was added to the manager.
| Improve this Doc View Source

ApplyButtonStyle(UnityEngine.UI.Button, Int32)

Apply valheim style to a Component
Declaration
public void ApplyButtonStyle(UnityEngine.UI.Button button, int fontSize = 16)
Parameters
Type Name Description
UnityEngine.UI.Button button Component to apply the style to
System.Int32 fontSize Optional font size, defaults to 16
| Improve this Doc View Source

ApplyDropdownStyle(Dropdown, Int32)

Apply Valheim style to a component.
Declaration
public void ApplyDropdownStyle(Dropdown dropdown, int fontSize = 16)
Parameters
Type Name Description
Dropdown dropdown Component to apply the style to
System.Int32 fontSize Optional font size, defaults to 16
| Improve this Doc View Source

ApplyInputFieldStyle(InputField)

Apply Valheim style to an Component.
Declaration
[Obsolete("Only here for backward compat")]
public void ApplyInputFieldStyle(InputField field)
Parameters
Type Name Description
InputField field Component to apply the style to
| Improve this Doc View Source

ApplyInputFieldStyle(InputField, Int32)

Apply Valheim style to an Component.
Declaration
public void ApplyInputFieldStyle(InputField field, int fontSize = 16)
Parameters
Type Name Description
InputField field Component to apply the style to
System.Int32 fontSize Optional font size, defaults to 16
| Improve this Doc View Source

ApplyScrollbarStyle(Scrollbar)

Apply Valheim style to a component.
Declaration
public void ApplyScrollbarStyle(Scrollbar scrollbar)
Parameters
Type Name Description
Scrollbar scrollbar Component to apply the style to
| Improve this Doc View Source

ApplyScrollRectStyle(ScrollRect)

Apply Valheim style to a component.
Declaration
public void ApplyScrollRectStyle(ScrollRect scrollRect)
Parameters
Type Name Description
ScrollRect scrollRect Component to apply the style to
| Improve this Doc View Source

ApplySliderStyle(Slider)

Apply Valheim style to a component.
Declaration
public void ApplySliderStyle(Slider slider)
Parameters
Type Name Description
Slider slider
| Improve this Doc View Source

ApplySliderStyle(Slider, Vector2)

Apply Valheim style to a component.
Declaration
public void ApplySliderStyle(Slider slider, Vector2 handleSize)
Parameters
Type Name Description
Slider slider
Vector2 handleSize
| Improve this Doc View Source

ApplyTextStyle(Text, Color, Int32, Boolean)

Apply Valheim style to a Component. Uses
GUIManager.Instance.AveriaSerifBold
by default
Declaration
public void ApplyTextStyle(Text text, Color color, int fontSize = 16, bool createOutline = true)
Parameters
Type Name Description
Text text Target component
Color color Custom color or
GUIManager.Instance.ValheimOrange
System.Int32 fontSize Optional font size, defaults to 16
System.Boolean createOutline creates an component when true
| Improve this Doc View Source

ApplyTextStyle(Text, Font, Color, Int32, Boolean)

Apply Valheim style to a Component
Declaration
public void ApplyTextStyle(Text text, Font font, Color color, int fontSize = 16, bool createOutline = true)
Parameters
Type Name Description
Text text Target component
Font font Own font or
GUIManager.Instance.AveriaSerifBold
/
GUIManager.Instance.AveriaSerif
Color color Custom color or
GUIManager.Instance.ValheimOrange
System.Int32 fontSize Optional font size, defaults to 16
System.Boolean createOutline creates an component when true
| Improve this Doc View Source

ApplyTextStyle(Text, Int32)

Apply Valheim style to a Component. Uses
GUIManager.Instance.AveriaSerifBold
,
Color.white
and creates an outline by default
Declaration
public void ApplyTextStyle(Text text, int fontSize = 16)
Parameters
Type Name Description
Text text Target component
System.Int32 fontSize Optional font size, defaults to 16
| Improve this Doc View Source

ApplyToogleStyle(UnityEngine.UI.Toggle)

Apply Valheim style to a component.
Declaration
public void ApplyToogleStyle(UnityEngine.UI.Toggle toggle)
Parameters
Type Name Description
UnityEngine.UI.Toggle toggle Component to apply the style to
| Improve this Doc View Source

ApplyWoodpanelStyle(Transform)

Apply Valheim style to a woodpanel.
Declaration
public void ApplyWoodpanelStyle(Transform woodpanel)
Parameters
Type Name Description
Transform woodpanel
| Improve this Doc View Source

BlockInput(Boolean)

Block all input except GUI
Declaration
public static void BlockInput(bool state)
Parameters
Type Name Description
System.Boolean state Indicator if the input should be blocked or released
| Improve this Doc View Source

CreateButton(String, Transform, Vector2, Vector2, Vector2, Single, Single)

Create a new button (Valheim style).
Declaration
public GameObject CreateButton(string text, Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 position, float width = 0F, float height = 0F)
Parameters
Type Name Description
System.String text Text to display on the button
Transform parent Parent transform
Vector2 anchorMin Min anchor
Vector2 anchorMax Max anchor
Vector2 position Position
System.Single width Set width if > 0
System.Single height Set height if > 0
Returns
Type Description
GameObject Button GameObject in Valheim style
| Improve this Doc View Source

CreateColorPicker(Vector2, Vector2, Vector2, Color, String, ColorPicker.ColorEvent, ColorPicker.ColorEvent, Boolean)

Creates and displays a Valheim style ColorPicker
Declaration
public void CreateColorPicker(Vector2 anchorMin, Vector2 anchorMax, Vector2 position, Color original, string message, ColorPicker.ColorEvent onColorChanged, ColorPicker.ColorEvent onColorSelected, bool useAlpha = false)
Parameters
Type Name Description
Vector2 anchorMin Min anchor on first instantiation
Vector2 anchorMax Max anchor on first instantiation
Vector2 position Position on first instantiation
Color original Color before editing
System.String message Display message
ColorPicker.ColorEvent onColorChanged Event that gets called when the color gets modified
ColorPicker.ColorEvent onColorSelected Event that gets called when one of the buttons done or cancel get pressed
System.Boolean useAlpha When set to false the colors used don't have an alpha channel
| Improve this Doc View Source

CreateDropDown(Transform, Vector2, Vector2, Vector2, Int32, Single, Single)

Create dropdown field
Declaration
public GameObject CreateDropDown(Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 position, int fontSize = 16, float width = 0F, float height = 0F)
Parameters
Type Name Description
Transform parent Parent transform
Vector2 anchorMin Min anchor
Vector2 anchorMax Max anchor
Vector2 position Position
System.Int32 fontSize Optional font size, defaults to 16
System.Single width Set width if > 0
System.Single height Set height if > 0
Returns
Type Description
GameObject
| Improve this Doc View Source

CreateGradientPicker(Vector2, Vector2, Vector2, Gradient, String, GradientPicker.GradientEvent, GradientPicker.GradientEvent)

Creates and displays a Valheim style GradientPicker
Declaration
public void CreateGradientPicker(Vector2 anchorMin, Vector2 anchorMax, Vector2 position, Gradient original, string message, GradientPicker.GradientEvent onGradientChanged, GradientPicker.GradientEvent onGradientSelected)
Parameters
Type Name Description
Vector2 anchorMin Min anchor on first instantiation
Vector2 anchorMax Max anchor on first instantiation
Vector2 position Position on first instantiation
Gradient original Color before editing
System.String message Display message
GradientPicker.GradientEvent onGradientChanged Event that gets called when the gradient gets modified
GradientPicker.GradientEvent onGradientSelected Event that gets called when one of the buttons done or cancel gets pressed
| Improve this Doc View Source

CreateInputField(Transform, Vector2, Vector2, Vector2, InputField.ContentType, String, Int32, Single, Single)

Create a new InputField (Valheim style).
Declaration
public GameObject CreateInputField(Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 position, InputField.ContentType contentType = null, string placeholderText = null, int fontSize = 16, float width = 0F, float height = 0F)
Parameters
Type Name Description
Transform parent Parent transform
Vector2 anchorMin Min anchor
Vector2 anchorMax Max anchor
Vector2 position Position
InputField.ContentType contentType Content type for the input field
System.String placeholderText Text to display as a placeholder (can be null)
System.Int32 fontSize Optional font size, defaults to 16
System.Single width Set width if > 0
System.Single height Set height if > 0
Returns
Type Description
GameObject Input field GameObject in Valheim style
| Improve this Doc View Source

CreateKeyBindField(String, Transform, Single, Single)

Create key binding field
Declaration
public GameObject CreateKeyBindField(string text, Transform parent, float width, float height)
Parameters
Type Name Description
System.String text
Transform parent
System.Single width
System.Single height
Returns
Type Description
GameObject
| Improve this Doc View Source

CreateScrollView(Transform, Boolean, Boolean, Single, Single, ColorBlock, Color, Single, Single)

Create a complete scroll view
Declaration
public GameObject CreateScrollView(Transform parent, bool showHorizontalScrollbar, bool showVerticalScrollbar, float handleSize, float handleDistanceToBorder, ColorBlock handleColors, Color slidingAreaBackgroundColor, float width, float height)
Parameters
Type Name Description
Transform parent parent transform
System.Boolean showHorizontalScrollbar show horizontal scrollbar
System.Boolean showVerticalScrollbar show vertical scrollbar
System.Single handleSize size of the handle
System.Single handleDistanceToBorder
ColorBlock handleColors Colorblock for the handle
Color slidingAreaBackgroundColor Background color for the sliding area
System.Single width rect width
System.Single height rect height
Returns
Type Description
GameObject
| Improve this Doc View Source

CreateText(String, Transform, Vector2, Vector2, Vector2, Font, Int32, Color, Boolean, Color, Single, Single, Boolean)

Create a with a Text (and optional Outline and ContentSizeFitter) component
Declaration
public GameObject CreateText(string text, Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 position, Font font, int fontSize, Color color, bool outline, Color outlineColor, float width, float height, bool addContentSizeFitter)
Parameters
Type Name Description
System.String text Text to show
Transform parent Parent transform
Vector2 anchorMin Anchor min
Vector2 anchorMax Anchor max
Vector2 position Anchored position
Font font Font
System.Int32 fontSize Font size
Color color Font color
System.Boolean outline Add outline component
Color outlineColor Outline color
System.Single width Width
System.Single height Height
System.Boolean addContentSizeFitter Add ContentSizeFitter
Returns
Type Description
GameObject A text
| Improve this Doc View Source

CreateToggle(Transform, Single, Single)

Create toggle field
Declaration
public GameObject CreateToggle(Transform parent, float width, float height)
Parameters
Type Name Description
Transform parent Parent transform
System.Single width Set width
System.Single height Set height
Returns
Type Description
GameObject
| Improve this Doc View Source

CreateWoodpanel(Transform, Vector2, Vector2, Vector2, Single, Single)

Creates a Valheim style woodpanel which is draggable per default
Declaration
public GameObject CreateWoodpanel(Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 position, float width = 0F, float height = 0F)
Parameters
Type Name Description
Transform parent Parent
Vector2 anchorMin Minimal anchor
Vector2 anchorMax Maximal anchor
Vector2 position Anchored position
System.Single width Optional width
System.Single height Optional height
Returns
Type Description
GameObject A as a Valheim style woodpanel
| Improve this Doc View Source

CreateWoodpanel(Transform, Vector2, Vector2, Vector2, Single, Single, Boolean)

Creates a Valheim style woodpanel, can optionally be draggable
Declaration
public GameObject CreateWoodpanel(Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 position, float width = 0F, float height = 0F, bool draggable = true)
Parameters
Type Name Description
Transform parent Parent
Vector2 anchorMin Minimal anchor
Vector2 anchorMax Maximal anchor
Vector2 position Anchored position
System.Single width Optional width
System.Single height Optional height
System.Boolean draggable Optional flag if the panel should be draggable (default true)
Returns
Type Description
GameObject A as a Valheim style woodpanel
| Improve this Doc View Source

GetSprite(String)

Get a sprite by name.
Declaration
public Sprite GetSprite(string spriteName)
Parameters
Type Name Description
System.String spriteName The sprite name
Returns
Type Description
Sprite The sprite with given name
| Improve this Doc View Source

Init()

Initialize the manager
Declaration
public void Init()
| Improve this Doc View Source

IsHeadless()

Detect headless mode (aka dedicated server)
Declaration
public static bool IsHeadless()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

RemoveKeyHint(KeyHintConfig)

Removes a KeyHintConfig from the game.
Declaration
[Obsolete("Use KeyHintManager.RemoveKeyHint instead")]
public void RemoveKeyHint(KeyHintConfig hintConfig)
Parameters
Type Name Description
KeyHintConfig hintConfig The custom key hint config to add.

Events

| Improve this Doc View Source

OnCustomGUIAvailable

Event that gets fired every time the Unity scene changed and new CustomGUI objects were created. Subscribe to this event to create your custom GUI objects and add them as a child to either CustomGUIFront or CustomGUIBack.
Declaration
public static event Action OnCustomGUIAvailable
Event Type
Type Description
System.Action
| Improve this Doc View Source

OnPixelFixCreated

Event that gets fired every time the Unity scene changed and a new PixelFix object was created. Subscribe to this event to create your custom GUI objects and add them as a child to the PixelFix.
Declaration
[Obsolete("Use OnCustomGUIAvailable")]
public static event Action OnPixelFixCreated
Event Type
Type Description
System.Action

Extension Methods

PrefabExtension.FixReferences(Object)
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾