In-game script editing

So, I was wondering if it was possible to have an editor in-game, that when you type up a script in it, then it changes one of the scripts in the unity project itself. for example…
in the game on an input field: types up “bob”
in one of the scripts in the unity project: there appears a comment “bob”

is that possible?

You can’t change scripts that are part of the game. You could, however, include some language compiler in your game and let players write some scripts.
There are two main options:

  • Compile C# and load it directly to the AppDomain. This gives you all the power that normal scripts in unity have, but there are some disadvantages. For example, an assembly that’s once loaded, cannot be unloaded from it, ever.
  • Embed some custom scripting environment. Lua used to be very popular for game scripting, there’s also a C# version called MoonSharp.

ok, but how would i do that?