Ghost Commands
  • Getting Started
    • Quickstart
    • Syntax
      • Command syntax
      • Arguments with multiple values
    • Custom commands
  • Documentation
    • Commands
      • Static commands
      • Non-static commands
      • Dynamic commands
      • Overloads
      • Parameters
      • Additional attributes
    • Suggestions
      • Suggestion attributes
      • Suggestor methods
    • Converters
      • Custom parameter types
      • Using the ArgumentReader
      • Multiple ways to interpret an argument
    • Processors
      • Creating a processor
      • Setting priorities
      • Cheat codes example
    • Macros
    • Settings
    • Customization
    • Included Commands
Powered by GitBook
On this page
  • Custom suggestion attributes
  • Built-in suggestion attributes​

Was this helpful?

  1. Documentation
  2. Suggestions

Suggestion attributes

Custom suggestion attributes

Most parameter types such as enum, bool, Color and derivatives from UnityEngine.Object already comes with suggestions. However, it's also possible to define your own custom suggestions that you can specify on individual parameters.

To define your own suggestions, make a new class that inherits from SuggestionAttribute:

public class PositionAttribute : SuggestionAttribute
{
    public override IEnumerable<string> Get()
    {
        string[] positions = { "(0,0,0)", "(20,10,20)", "(5,100,5)" };
        return positions;
    }
}

Then to see the suggestions on a parameter, put the attribute on the parameter in the method.

public class Player : MonoBehaviour
{
    [Command]
    public void Teleport([Position] Vector3 position)
    {
        transform.position = position;
    }
}
  • [SceneName] - List of all scenes.

  • [CommandName] - List of all loaded commands.

PreviousSuggestionsNextSuggestor methods

Last updated 7 months ago

Was this helpful?

Built-in suggestion attributes

​