- In Flax Editor go to
Journal/Source/Journal/and placeConsoleManager.csscript in the scene where u want (for example in Scene actor) - Go to
Journal/Content/dragConsolePrefabinto "ConsolePrefab" field in script - If you want to customize console UI:
- Go to
Journal/Content/in editor and dragConsolePrefabon to the scene - In ConsoleManager script set
CreateConsoleFromPrefabunchecked - Drag console actor to
ConsoleActorfield
- Go to
- After starting game press open key (by default "~") and use the console
Like this:
using FlaxEngine;
using Journal;
namespace Game
{
public class Test : Script
{
public override void OnStart()
{
ConsoleManager.RegisterCommand("hello", Hello); // <---
}
public void Hello()
{
Debug.Log("Hello, world!");
// Do something here
}
}
}- Tab: Selecting hints when editing
- Arrow Up: Get previous commands
- Arrow Down: Get recent commands
- Go to Tools->Plugins in Editor. In a window press "Clone Project".
- A) Download this project .zip or .tar.gz and unpack it in folder near your project (for example
<your-flax-project-path>/Plugins/Journal/) - B) Clone the repo. Command:
git clone https://github.com/Crawcik/Journal.git - Add in your
.flaxprojfile path to plugin, like in this example:
{
"GameTarget": "GameTarget",
"EditorTarget": "GameEditorTarget",
"References": [
{
"Name": "$(EnginePath)/Flax.flaxproj"
},
{
"Name": "$(ProjectPath)/Plugins/Journal/Journal.flaxproj"
}
],
}- Download, unpack & run Flax Plugin Manager [Click here]
- Select your project & add Journal
Go to <your-flax-project-path>/Source/Game/Game.Build.cs and add "Journal" module, here is example: if you don't want to use commands this is optional
public override void Setup(BuildOptions options)
{
base.Setup(options);
options.PrivateDependencies.Add("Journal"); // Adds reference to Journal types
}If something doesn't work: check logs, try deleting Cache folder or generate project files manually
Also here is official tutorial for installing plugins: https://docs.flaxengine.com/manual/scripting/plugins/plugin-project.html
This method is better if you want to integrate "Journal" in your plugin, but you want to have it optional (no need to have Journal installed).
Copy <journal-project-path>/Content/JournalExtension.cs to desired module source code folder. You can now use functions in the Journal class without referencing Journal in .flaxproj
public override void OnStart()
{
Journal.RegisterCommand<int>("is_odd", IsOdd);
}
public static void IsOdd(int number)
{
Debug.Log("This number is" + number%2==0 ? "odd" : "not odd");
}The commands will appear, if Journal is referenced if any other project, like top project! If not, dont worry. Your code will still compile without it being present!