[Released] InGame Code Editor

4364407--417205--FeatureTrimmed.png

Asset Store | Documentation

InGame Code Editor is an advanced input field for Unity that makes use of TextMesh Pro to display syntax highlighted code. Much of the inspiration for the syntax highlighting is taken from notepad++ and as a result it is extremely customizable allowing you to add syntax highlighting support for new languages.

Requirements

  • Requires TextMesh Pro (Installable via package manager)

Features

  • Very easy to use. Just drop the prefab into your scene and customize
  • Full text editing features that you would expect
  • Includes optional line numbers column
  • Fully customizable editor themes
  • Includes 3 pre-set themes: Light, Dark and Terminal
  • Fully customizable syntax highlighting
  • Highly optimized lexer for quick syntax highlighting of large text
  • Supports syntax highlighting of keywords, symbols, numbers, comments and quote strings
  • Keyword groups mean that you can highlight keywords in different colors
  • Built in syntax highlighting support for C# (multiple), Lua, MiniScript and JSON
  • You can easily add support for additional syntax highlighted languages
  • Supports basic auto indentation using opening and closing tags
  • Comprehensive .chm documentation of the API for quick and easy reference
  • Fully commented C# source code included

4440058–406189–UserGuide.pdf (447 KB)

3 Likes

We are pleased to announce that InGame Code Editor has now been approved and is live on the asset store. Check if out here!

InGame Code Editor version 1.0.1 has been submitted to the asset store for review. This version fixes a minor issue where line comments and block comments starting with similar characters would not be handled correctly.

InGame Code Editor version 1.0.2 has been submitted to the asset store for review. This version adds syntax highlighting for javascript core.

InGame Code Editor version 1.0.3 has been submitted to the asset store for review. This version contains:

  • Fixed an auto indenting bug where deep levels of indenting were not handled correctly
  • Fixed an auto indenting bug where the closing character could exist on the same line as the caret
  • Auto indent closing characters will now be placed on a new line if required and the caret will be moved to the previous line after the auto indent tab string.

InGame Code Editor version 1.0.4 has been submitted to the asset store. This version fixes a syntax highlighting bug and also adds basic auto tab support for all language themes. Adding a new line will now cause the caret to be auto tabbed based upon the previous line.

InGame Code Editor version 1.0.6 has been submitted to the asset store.

  • Added a compatibility option for TMP to apply line height fix (Unity 2018.2 and newer). This may be required depending upon the TMP version you are using to correctly sync the line highlighter in the code window.
  • Fixed a bug where the line highlighter could become out of sync when some text is deleted.
  • Fixed a bug where the line numbers would not be synced correctly when deleting all text.
1 Like

Is there a sample integration provided with support for your Roslyn asset? Esp. in 2019.3 beta now that it works. Or even better for your uMod 2?

Hi, We have not added anything like this yet. What sort of sample would you like to see? Just a demo scene using IGCE with Roslyn C# or something more? It may take a bit of work to distribute something like this as thee will be 2 asset requirements but we should be able to work something out.

Correct just a simple demo. I think it helps promote sales, esp. if the integrations are tested or at least fixed when reported. I try to buy assets that work together - even better if there is a basic integration already made showing best practices between the assets I want to use.

Yes we can certainly add something like that to Roslyn C#. It is not something that we would add to uMod at the moment because currently uMod does not contain any means to compile code at runtime so a code editor would not be very useful.

For uMod - let me paint a use case.

Unity editor is a very powerful tool for Linux users. It can be hard for new users to figure out how to setup mono / vscode to act as an editor to a unity project with Linux Unity Editor. It is already a tough sell to convince potentional modders to dive into the Unity version madness. Near impossible to get them to buy into sorting through all the issues with Unity Editor on Linux while also getting a decent code environment setup.

Enter ingame code. Now if there was a way to offer a lite version, something we could include in our mod kit we provide (great implementation btw) or something that let the modders code while in play mode within Unity. The user experience is far better to get started modding. (which we want to be easy to start and see the potential)

They can get started, and when ready to mess with the editor and code env. on Linux, they can cross that bridge when they need to.

I’m not saying solve all that. Stuff like saving and loading files etc. is not within the realm of the idea. I’m mainly just trying to see if there might be a way to offer it for the modders so when they hit play, they can start coding right in Unity to get their feet wet.

Thanks for the use case. I can understand how it IGCE could be useful in this situation however currently there is not real any possible interconnectability with uMod and IGCE. IE you cant just write code at runtime and pass that code to uMod so I don’t think a demo scene would be very useful in this situation. You would essentially just end up with the default IGCE demo scene and nothing more. If you wanted to use IGCE along with uMod you could just import the asset and use the documentation to set it up in addition. If further down the line we added the feature you describe allowing modders to write code in playmode while developing mods then we could certainly add an extra demo at that point.

1 Like

In Game Code Editor version 1.0.7 has been submitted to the asset store for review and should be available for download within a few days. This version includes:

  • Added an integration demo package showing how IGCE can integrate into our other asset Rolsyn C#
  • Fixed a null reference exception which occured when the ‘Text’ property was assgined but the code editor component or game object was disabled.
  • Fixed a bug where the line highlight would stay fixed in position relative to the screen when scrolling via the mouse wheel or scroll bar.
  • Fixed a bug where the ‘Text’ property of the code editor would sometimes return a string with an additional ‘"’ character.

In Game Code Editor version 1.0.8 has been submitted to the asset store. This version allows you to move the line highlight bar to a specific line via code. You can now also lock the line highligh bar in position to prevent the user from moving it when editing text which could be useful for debug step though features or similar.

In Game Code Editor version 1.0.9 has been submitted to the asset store. This version fixes an issue where setting the code editor text via script would not update the line numbers correctly.

When I add the integration package there are errors for

Assets\InGameCodeEditor_CompatibilityDemo\RoslynCSharp_CompatibilityDemo\Scripts\IGCEMazeCrawlerExample.cs(109,66): error CS1503: Argument 1: cannot convert from ‘System.Reflection.Assembly’ to ‘RoslynCSharp.Compiler.IMetadataReferenceProvider’

Repeated for each of the 4 lines there.

(I’m using 2019.4.01f1 if that might make the difference)

Hi,
Thanks for reporting these errors. It looks like the compatibility demo was not updated to support the latest Roslyn C# version. We have now fixed this and will be submitting an update for IGCE shortly. I have sent you a PM with the update package so you don’t have to wait for the update to be released.

1 Like

I’m running into an issue with caret placement (with Unity 2018.4.24f1 and TMP 1.4.1): If I set the Text property from another script, then the user clicks into the text field past the end of the line, the caret is placed one character before the end, while I would expect it to be at the very end of the line. Clicking again seems to place it correctly.

Additionally, setting Text to an empty strings causes it to throw IndexOutOfRangeException every frame until I focus the editor