Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: PromptText and PromptIcon should not attempt to display a prompt icon if one is not found. #4

Open
thsbrown opened this issue Aug 23, 2023 · 1 comment

Comments

@thsbrown
Copy link
Contributor

In my use case i want a prompt icon to be display normally if one is found for both the PromptIcon and PromptText and one to not attempt to be displayed if one is not found.

I figured the best way to do this might be another setting in the settings SO. There's a few ways I have devised doing this. I will list them below.

  1. A single setting for both PromptIcon and PromptText that defines what to do if a sprite is not found.
public enum SpriteNotFoundBehavior
{
    ///<summary>
    /// Let each component handle what happens individually if a sprite is not found.
    ///</summary>    
    Default,
    ///<summary>
    /// In the case of PromptText wherever [Example/Prompt] comes up short display nothing.
    /// In the case of PromptIcon wherever [Example/Prompt] comes up short disable Gameobject or Image component.
    ///</summary>
    SuppressDisplay
}
  1. A settings for both PromptIcon and PromptText that defines how we should handle sprite not found scenarios.
PromptIconSpriteNotFoundBehavior
{
    ///<summary>
    /// Do nothing (current behavior)
    ///</summary>    
    Default,
    ///<summary>
    /// Disable the gameobject that the PromptIcon is attached to when sprite is not found.
    ///</summary>    
    DisableGameobject,
    ///<summary>
    /// Disable the Image component that the PromptIcon is attached to when sprite is not found.
    ///</summary>    
    DisableImage
}

PromptTextSpriteNotFoundBehavior
{
    ///<summary>
    /// Display error message that's the reason for no sprite showing (current behavior)
    ///</summary>    
    Default,
    ///<summary>
    /// Skips over any [Example/Prompt] that can't be found, preserving the text as it was.
    ///</summary>    
    PreserveOriginalText
}
  1. A debug mode variable in the settings bool debugMode. When enabled it will display why icons for devices aren't showing as they potentially should be. Sort of how PromptText works. In the case of PromptIcon perhaps there is a debug sprite that shows when no sprite can be found in order to visually see that this is the case.

Let me know what you think :). I will likely roll one of these solutions on my own project immediately, as I need this functionality, but I'm curious if anyone has any input on what might be the best behavior.

@simonoliver
Copy link
Owner

Yeah this is a great idea - I got caught out on this making a trailer recently! I'd maybe add two boolean settings:

  1. Display missing tag errors on Development Builds (default true)
  2. Display missing tag errors on non-development builds (Default false)

then do something like this in InputDevicePromptSystem:

static bool DisplayTagErrors {

get {

#if DEVELOPMENT_BUILD || UNITY_EDITOR
return s_Settings.DisplayTagErrorsDevelopmentBuild;
#else
 return s_Settings.DisplayTagErrorsNonDevelopmentBuild;
#endif

}
}

And use in functions like GetActionPathBindingTextSpriteTags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants