Register custom resources for Godot mono
Script res://Example/LevelConfig.cs
using Godot;
namespace Example
{
public class LevelConfig : Resource
{
[Export]
public PlayerConfig PlayerConfig;
}
}
Script res://Example/PlayerConfig.cs
using Godot;
namespace Example
{
public class PlayerConfig : Resource
{
[Export]
public int Speed;
}
}
Create LevelConfig.tres int context menu "New Resource...":
Cerate PlayerConfig in LevelConfig.tres (Open LevelConfig.tres and create PlayerConfig):
using Godot;
namespace Example
{
public class Enemy : KinematicBody2D
{
}
}
Add Enemy in scene (context menu "Add Child Node")
- clone this repository and move folder addons/CustomResourceRegister in {your project}/addons/
- add this folder to project in IDE
- build solution
- enable addon in settings
Project -> ProjectSettings -> General -> CustomResourceRegister:
- ScriptsFolder - Scripts folder. The path to the script is calculated as follows: $"{ScriptsFolder}/{class.Namespace}/{class.Name}.cs"
- ClassPrefix - Prefix the class name to sort in the inspector
To register new created classes press "Refresh" in bottom panel "CRR"