Search Unity

Assets In game command console

Discussion in 'Works In Progress - Archive' started by PenDigi, Jul 13, 2017.

  1. PenDigi

    PenDigi

    Joined:
    Sep 19, 2015
    Posts:
    14
    Hey guys, just made an in-game command console. It has helped me in quite a few of my projects so far and just wanted to share it and see what people think.

    Hopefully it isn't too difficult to use or too cluttered to understand.



    The console has some inbuilt commands such as movego, togglego, creatego
    You can open up the source and have a look if you want to make your own commands.

    Some usage notes:
    • Register your callback command function in OnEnable and remove it OnDisable. You can treat a set of commands as a module with game objects this way and toggle modules on/off.
    • You can register multiple callbacks to the same command per object instance, for example if you have AI Entities each one can register a callback onenable and they would all perform the callback for each object.
    • The command line arguments are space delimited but you can encase the argument in double quotes to force the parser to treat the whole string as an argument.
    • '?' lists all loaded commands in the console.
    • Left/Right arrow keys move the input cursor, Up/Down arrow keys go through previously entered commands.
    Here are the current supported parsing types in the command line:
    • Vectors 2, 3, 4 and Color(Vector4 internally)
      Use case example: 0,0,-10 and "0, 0, -10" are equivalent
    • GameObject
      Does a simple GameObject.Find(name) and returns the gameobject
    • Any object that implements the System.IConvertible interface

    I don't really intend to place it on the asset store, if I do it'll be free. Otherwise I'm just sharing some knowledge and hope I can get some feedback in return.
     

    Attached Files:

  2. MakeGames2

    MakeGames2

    Joined:
    May 23, 2016
    Posts:
    82
    This seems pretty nice.

    It doesn't seem to come with an example scene but based on your image I figured out to just place the object in a canvas and it will work fine. It would be great if there was an example scene with some new example commands or neat things you can do. Although it's pretty simple to see what you mean by looking through the code.

    It's really hard to resize the console object for some reason.

    It would be nice to see a tab to autocomplete option.

    I really like that there is a command history that you can browse and execute commands with.

    I also like the idea of being able to add it to game objects and the fact that it comes with commands to manipulate game objects.

    Seems quite useful. You could stick it on the asset store if it isn't already there and maybe get more exposure and feedback.

    Thank you for releasing it free!
     
    PenDigi likes this.
  3. PenDigi

    PenDigi

    Joined:
    Sep 19, 2015
    Posts:
    14
    Thanks for your feedback! Ill try adding it to the store later.