Skip to content

dev-c2m/CodeEditor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Editor

alt text alt text
alt text

Description | Features | Installation | Usage | Contributing

Description

This is a versatile in-game code editor that can be used for various purposes.
It is built by making the most of Unity's TMP_InputField.
Shortcuts are implemented using Unity's new Input System.

Features

  • Indent / Unindent (with Multi Line)
  • Syntax Highlighting
  • Undo / Redo
  • Line Numbering
  • Auto Complete
  • Auto Indent
  • Horizontal / Vertical Scroll

Installation

This package requires TextMeshPro.

Install via UPM (Unity Package Manager)

  • Click Window > Package Manager to open Package Manager UI.
  • Click + > Install(or Add) package from git URL... and input the repository URL: https://github.com/dev-c2m/CodeEditor.git?path=Packages/src
    Image
  • To update the package, change suffix #{version} to the target version.
    • e.g. https://github.com/dev-c2m/CodeEditor.git?path=Packages/src#1.0.0

Usage

Getting Started

  1. Install the package.
  2. Download sample
    sample
  3. Drag and Drop prefab in Scene

We recommend downloading the sample and using the included prefab.

Setting

Language

Creating the Language Setting
Asset - Create - Code Editor - Language Setting
language

  • Keywords: The list of keywords for autocompletion and syntax highlighting.
  • Keyword Color: The color used to highlight the keywords.
  • Sub Keywords: Sub-keywords that belong to a main keyword. These are often static members or properties that appear after a main keyword (e.g., Vector3.zero).
  • Symbol: The list of symbols to be highlighted (e.g., +, -, *, /).
  • Line Comment: The string that marks the beginning of a single-line comment (e.g., //).
  • Multi Line Comment Start: The string that marks the beginning of a multi-line comment block (e.g., /*).
  • Multi Line Comment End: The string that marks the end of a multi-line comment block (e.g., */).
  • Comment Color: The color used for comments.
  • Auto Indent Language: Sets the style for automatic indentation. Currently, only C# is supported.
  • Indent Type: Sets the indentation character type: Tab or Space.
  • Auto Indent Chars: Characters that trigger an auto-indent on the next line (e.g., {).
  • Auto UnIndent Chars: Characters that trigger an auto-unindent on the current line (e.g., }).

Code Editor

codeeditor
Code Editor Setting

  • Language Setting: The language setting asset created above.
  • undoIdleThresholdSeconds: If there is no input for this duration (in seconds), the changes are recorded for the undo history.
  • Point Size: Adjusts the size of all fonts in the editor.

Auto Complete

auto

  • Language Setting: The language setting asset created above.
  • Max Suggestions: Specifies the maximum number of auto-complete suggestions. (-1 means no limit).
  • Code Complete Default Color: The background color for suggested auto-complete keywords.
  • Code Complete Select Color: The background color for a selected auto-complete keyword.

Contributing

Issues

Issues are very helpful for identifying areas that need improvement and can enhance the user experience. They are always welcome!

Pull Requests

Coming soon.

Support

This is an open-source project. If you found it helpful, please leave a star
alt text

License

MIT

About

This is a versatile in-game code editor that can be used for various purposes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published