MiTschMR Studios
  • MiTschMR Studios
  • Games
    • Defnite
  • Skills
    • Skills
      • Skills Overview
      • Skills Window
        • Skills
        • Types
        • Settings
      • Skills Component
      • Actions/Conditions/Triggers
      • Skill Tree
      • Skill Bar
      • FAQ
      • Example Setup
      • API Documentation
        • ButtonActionsSkills
          • Classes
            • ButtonActionsEvent
          • Fields
            • actions
            • onClickRight
            • onClick
          • Methods
            • Awake
            • OnValidate
            • OnPointerClick
            • OnSubmit
            • OnFinishSubmit
            • Press
            • PressRight
        • DatabaseSkills
          • Classes
            • SkillsList
              • Fields
                • skills
                • skillTypes
            • SkillSettings
              • Fields
                • skillTreeSelection
                • skillTreeUIPrefabAutomatic
                • skillTreeUIPrefabManual
                • pauseTimeOnUI
                • levelSelection
                • levelVariable
                • levelStat
                • skillPointsSelection
                • skillPointsVariable
                • skillPointsStat
              • Methods
                • GetPauseTimeOnUI
                • GetSkillTreeSelection
                • GetSkillTreeUIPrefabAutomatic
                • GetSkillTreeUIPrefabManual
                • GetLevelSelection
                • GetLevelVariable
                • GetLevelStat
                • GetSkillPointsSelection
                • GetSkillPointsVariable
                • GetSkillPointsStat
              • Enums
                • SkillTreeSelection
                • StatSelection
          • Fields
            • skillList
            • skillsSettings
          • Methods
            • GetSkillList
            • GetSkillListSkillByIndex
            • GetSkillTypes
            • GetSkillTypesTypeByIndex
            • GetSkillSettings
            • GetSkillSuggestions
            • GetSkillTypesNames
            • GetSkillTypesIDs
            • Load
            • InitializeOnLoad
            • GetProjectPath
        • Skill
          • Fields
            • uuid
            • skillName
            • skillDescription
            • icon
            • skillType
            • skillExecutionType
            • castTime
            • executionTime
            • cooldownTime
            • skillState
            • useSkillPoints
            • skillPointsNeeded
            • requiresLevel
            • level
            • reliesOnSkills
            • assignableToSkillBar
            • conditionsExecutionRequirements
            • actionsOnActivate
            • actionsOnCast
            • actionsOnExecute
            • actionsOnFinish
            • conditionsRequirements
            • actionsOnReset
          • Methods
            • CopySkill
            • CopySkillToSkillRelyOn
            • CreateSkillRelyOnInstance
            • UpdateSkillRelyOnInstance
            • DeleteSkillRelyOnInstance
            • CreateSkillInstance
            • OnDestroy
            • DestroyAsset
          • Enums
            • SkillState
            • SkillExecutionType
        • SkillAsset
          • Fields
            • uuid
            • isExecuting
            • isInCooldown
            • cooldownTimeLeft
            • addedToSkillBar
            • addedToSkillBarIndex
            • skillName
            • skillDescription
            • icon
            • skillType
            • skillExecutionType
            • castTime
            • executionTime
            • cooldownTime
            • skillState
            • useSkillPoints
            • skillPointsNeeded
            • requiresLevel
            • level
            • reliesOnSkills
            • assignableToSkillBar
            • conditionsExecutionRequirements
            • actionsOnActivate
            • actionsOnCast
            • actionsOnExecute
            • actionsOnFinish
            • conditionsRequirements
            • actionsOnReset
            • actionsOnResetExecuted
            • onChange
        • SkillBarElement
          • Fields
            • target
            • keyCode
            • skillIcon
            • skillNotAssigned
            • skillCooldownIcon
            • showSkillExecutingIcon
            • skillExecutingIcon
            • showKeyCodeText
            • keyCodeText
            • showExecutingTimeCounter
            • executingTimeCounter
            • showCooldownCounter
            • cooldownCounter
            • showAmountCounter
            • amountCounter
            • skill
            • executer
          • Methods
            • Start
            • Update
            • SetupEvents
            • ExecuteSkill
            • SyncSkill
            • StartSkillExecutionGUI
            • UpdateUI
            • CancelSkillBarSkillExecution
        • SkillBarElements
          • Fields
            • skillBarElements
          • Methods
            • Start
        • SkillBarSkillTreeElement
          • Fields
            • DATABASE_SKILLS
            • keyCode
            • acceptSkillTypes
            • skillIcon
            • skillNotAssigned
            • iconSkillBarConfigurationModeOn
            • iconSkillBarConfigurationModeOff
            • keyCodeText
            • showKeyCodeText
            • allowReplacement
            • allowQuickRemoval
            • skillInConfigurationMode
            • eventOnHoverEnter
            • eventOnHoverExit
            • skill
            • executer
            • skillBarConfigurationModeOn
            • skillTreeUIManager
            • skillBarSkillTreeElementIndex
          • Methods
            • Start
            • Update
            • SetupEvents
            • BindSkill
            • UnbindSkill
            • EnterSkillBarConfigurationMode
            • LeaveSkillBarConfigurationMode
            • RemoveSkillFromSkillBar
            • GetSkill
            • UpdateUI
            • OnPointerEnter
            • OnPointerExit
            • OnDragBegin
            • OnDragEnd
            • OnDragMove
        • SkillBarSkillTreeElements
          • Fields
            • skillBarElements
          • Methods
            • Start
        • SkillContextMenuUI
          • Fields
            • buttonUnlock
            • buttonAddToSkillBar
            • buttonRemoveFromSkillBar
        • SkillHolder
          • Fields
            • skill
          • Methods
            • ToString
        • SkillHolderSerialized
          • Fields
            • skill
          • Methods
            • ToString
        • SkillRelyOn
          • Fields
            • uuid
            • skillName
            • skillDescription
            • icon
            • skillType
            • skillExecutionType
            • castTime
            • executionTime
            • cooldownTime
            • skillState
            • useSkillPoints
            • skillPointsNeeded
            • requiresLevel
            • level
            • assignableToSkillBar
        • SkillTreeItemsUI
          • Fields
            • skills
          • Methods
            • Start
            • UpdateSkills
        • SkillTreeItemsUIAutomatical
          • Fields
            • skillsContainer
            • prefabSkill
            • prefabSkillConnectorEnabled
            • prefabSkillConnectorDisabled
            • distanceBetweenSkillsInLine
            • prefabSkillHolder
            • skillUIHolder
          • Methods
            • UpdateSkills
        • SkillTreeItemsUIManual
        • SkillTreeUIManager
          • Fields
            • TIME_LAYER
            • DATABASE_SKILLS
            • skillTreeAnimator
            • skillTreeRoot
            • isOpen
            • canvasScaler
            • floatingSkillRt
            • skillTreeOpener
            • skillBarElements
            • skillPointsLeft
            • skillsContent
            • floatingSkill
            • skillContextMenu
          • Methods
            • Awake
            • Open
            • Close
            • EnterSkillBarConfigurationMode
            • LeaveSkillBarConfigurationMode
            • SkillRemoveFromSkillBar
            • SetSkillTreeOpenerReferences
            • ResetAllSkills
            • ResetSkill
            • UpdateSkillPoints
            • HideSkillContextMenu
            • UpdateSkillBar
            • OnDragSkill
            • IsOpen
            • ChangeState
            • ResetSkillBar
            • ResetSkillBar
            • GetPointerPositionUnscaled
        • SkillTreeUIManagerAutomatical
          • Fields
            • DEFAULT_UI_PATH
            • skillDistanceFromTop
            • distanceBetweenSkillTypes
            • skillTypeSize
            • skillTypePrefab
            • skillTypes
          • Methods
            • Open
            • OpenSkillTree
            • CloseSkillTree
            • IsSkillTreeOpen
            • RequireInstance
        • SkillTreeUIManagerManual
          • Fields
            • DEFAULT_UI_PATH
          • Methods
            • Open
            • OpenSkillTree
            • CloseSkillTree
            • IsSkillTreeOpen
            • RequireInstance
        • SkillType
          • Fields
            • MAX
            • id
            • name
        • SkillUI
          • Fields
            • DATABASE_SKILLS
            • button
            • skillTreeUIManager
            • skillTreeOpener
            • skillConnectorEnabled
            • skillConnectorDisabled
            • skillIconEnabled
            • skillIconDisabled
            • tooltipIcon
            • tooltipName
            • tooltipDescription
            • tooltipLevelRequiredValue
            • tooltipSkillPointsRequiredValue
            • tooltipSkillStateValue
            • tooltipSkillStateValueColorLocked
            • tooltipSkillStateValueColorUnlocked
            • imageLocked
            • imageUnlocked
            • skillTransform
            • prefabContextMenu
            • skillContextMenu
            • eventOnHoverEnter
            • eventOnHoverExit
          • Methods
            • OnDragBegin
            • OnDragEnd
            • OnDragMove
          • Properties
            • SkillAsset
        • SkillUIAutomatical
          • Fields
            • nameOfSkillTreeUIPrefab
            • skillTreeUIPrefab
          • Methods
            • Setup
            • UpdateUI
        • SkillUIManual
          • Fields
            • skill
          • Methods
            • Setup
            • UpdateUI
        • Skills
          • Classes
            • SerialSkill
              • Fields
            • SerialData
              • Fields
                • skills
            • EventArgs
              • Fields
                • uuid
                • operation
              • Enums
                • Operation
            • EventSkillActivation
            • EventSkillsReset
          • Fields
          • Methods
            • Awake
            • Start
            • OnDestroy
            • GetSkillsDictionary
            • GetSkillPoints
            • GetLevel
            • GetSkill
            • GetSkills
            • GetSkillID
            • GetSkillState
            • GetSkillLockedState
            • GetSkillExecutionState
            • LockSkill
            • UnlockSkill
            • UpdateSkillState
            • CheckSkillRequirements
            • CheckSkillLevel
            • CheckSkillReliesOnSkills
            • CheckSkillOtherConditions
            • CheckSkillSkillPoints
            • ExecuteSkill
            • ExecuteSkillPermanent
            • ExecuteStartActivationPhase
            • ExecuteEndActivationPhase
            • ExecuteStartCastPhase
            • ExecuteEndCastPhase
            • ExecuteStartExecutionPhase
            • ExecuteEndExecutionPhase
            • ExecuteStartFinishPhase
            • ExecuteEndFinishPhase
            • StartCooldown
            • StopCooldown
            • CancelExecutingSkillBar
            • UpdateSkillBar
            • CancelExecutingSkill
            • CancelExecutingSkill
            • CancelExecutingSkills
            • ResetAllSkills
            • ResetSkill
            • ResetSkill
            • SyncSkillBarSkills
            • ChangeSkillType
            • ChangeSkillExecutionSettings
            • ResetPhaseProperties
            • FireResetSkillsEvent
            • AddOnChangeSkill
            • RemoveOnChangeSkill
            • UpdateSkillsList
            • RequireInit
          • Properties
            • IsActivatingSkill
            • IsCastingSkill
            • IsExecutingSkill
            • IsFinishingSkill
        • SkillsSingleSkillTypeAttribute
          • Fields
            • SKILLS
          • Methods
            • OnGUI
  • Finder for Game Creator
    • Finder for Game Creator
      • The Finder Window
        • Triggers
        • Conditions
        • Actions
        • Components
        • Scriptable Objects
      • Extension Installer
  • Finder for Game Creator 2
    • Finder for Game Creator 2
      • The Finder Window
        • Triggers
        • Conditions
        • Actions
        • Components
        • Scriptable Objects
        • Preferences
  • More Extensions
    • List Of My Extensions
  • GC API Guides
    • About
    • Configurable Enter Play Mode Compatibility
    • Access GC Script Components
    • Access Player Using HookPlayer
    • Inventory Custom Entries
    • Accessing Scriptable Objects
    • Custom Editor Windows - Part 1
    • Custom Editor Windows - Part 2
    • Inventory Context Menu Support
    • Inventory Item Tooltips
    • Converting To GC Variables
    • Working With GC Variables
  • C# Code Style Guide
    • C# Code Style Guide For Game Creator
Powered by GitBook
On this page
  • Prerequisites
  • Tooltips
  • Set Up The Inventory Items
  • Prepare A Tooltip Gameobject
  • ItemUI Script Changes
  • Add References To The Variables
  • Enable And Disable The Tooltip When Hovering

Was this helpful?

  1. GC API Guides

Inventory Item Tooltips

What, this item gives +20% bonus to health?

PreviousInventory Context Menu SupportNextConverting To GC Variables

Last updated 1 year ago

Was this helpful?

The documentation has moved to:

This version will no longer be updated and maintained.

In this tutorial, I want to show you how to modify the Game Creator inventory to add a tooltip with certain information that gets shown when you hover over an item.

Prerequisites

  • Install Unity

  • Install IDE (I use Visual Studio 2019)

  • Import Game Creator

  • Import and enable the Inventory module

  • Understanding of the previous guide

Tooltips

A tooltip is a window that shows additional information on a GUI element you hover over. The information may contain a description, a reference to something else, pictures and more. The tooltip I made for this tutorial looks like this:

Set Up The Inventory Items

Depending on which informations you want to have in your tooltip, you need to add custom entries to the Inventory items. In my case, I want the icon and description of the item as well as a custom string entry with the name My Bonus 1.

Prepare A Tooltip Gameobject

You need a tooltip gameobject in your preferred item prefab, like ItemRPG or ItemAdventure (even though I prefer using the ItemRPG because it has much more space to be used for the tooltip). I have already prepared a basic tooltip prefab for you to just drag below the root gameobject of your item prefab.

Download the package and import it into your project. Drag it into your item prefab like this:

Add the image/text etc. elements you want to display below GameObject, and change them to your needs (font color, font size, background sprites etc.). The prefab is fully customizable. Make sure the tooltip gameobject is deactivated before entering the play mode so it doesn't show when you open the inventory.

ItemUI Script Changes

Now we need to add some variables and functionality to the ItemUI script, which you can find under Assets --> Plugins --> GameCreator --> Inventory --> Mono --> UI --> Inventory --> ItemUI.cs.

Adding Variables

In the PROPERTIES section, below public Text textDescription , add the following lines of code:

[Space]
public Image tooltipImage;
public Text tooltipDescription;
public Text tooltipMyBonus1;

Add a variable for each element you want to display in the tooltip.

Reference The Variables

Now we need add some functionality to assign values to these variables when opening the inventory. In the UpdateUI() method in the PUBLIC METHODS section, below if (this.textDescription != null) this.textDescription.text = item.itemDescription.GetText(); add this code:

if (this.tooltipImage != null) this.tooltipImage.sprite = item.sprite;
if (this.tooltipDescription != null) this.tooltipDescription.text = item.itemDescription.GetText();
if (this.tooltipMyBonus1 != null) this.tooltipMyBonus1.text = item.myBonus1;

If the variables we added before are not null (empty), the image, description and the myBonus1 property of the item are being assigned to the variables. If you want to assign your own values, you obviously need to choose your own properties.

Add References To The Variables

In your item prefab, assign the image, description and other gameobjects to the variables we just added in the script:

Enable And Disable The Tooltip When Hovering

The last thing we need to do is enable the tooltip gameobject when you hover over the item and disable it when you leave the item area. Do this in the hovering event fields of the same script/gameobject as in the previous image:

Run the game and see how the tooltips appear and disappear while showing the information you want.

It accesses the icon of the item, the description and a custom entry I added with the help of a previous tutorial (linked in and below). But let's start from the beginning.

You can add custom entries too when following the guide . They can be of any type you want (int, string, a stat value etc.).

Inventory Custom Entries
Prerequisites
https://mitschmr-studios.io/documentation/api-guides/inventoryitemtooltips.html
Inventory Custom Entries
2KB
Tooltip.unitypackage