| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
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
}
}
}{
"GameTarget": "GameTarget",
"EditorTarget": "GameEditorTarget",
"References": [
{
"Name": "$(EnginePath)/Flax.flaxproj"
},
{
"Name": "$(ProjectPath)/Plugins/Journal/Journal.flaxproj"
}
],
}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!
| Back | FazBrowse Home | New Git URL |