Hey there! I have a small feature request.
I can see that you made a possibility of creating a custom assembly for custom NetCode generator templates.
I was able to add my own CodeGen templates for classes in my project, however I had to modify the visibility of the CodeGenTypes
class to be able to access the Registry
and add the template description.
This is the code example:
public static class CustomCodeGenTypeRegister
{
public const string TEMPLATE_PATH = "Assets/Scripts/Editor/NetCode/Generator/Templates/";
[InitializeOnLoadMethod]
public static void Initialize()
{
var typeRegistry = CodeGenTypes.Registry;
typeRegistry.RegisterType(typeof(InventoryDTO), TypeAttribute.Empty(), new TypeTemplate
{
TemplatePath = TEMPLATE_PATH + "InventoryDTOSerializer.cs"
});
typeRegistry.RegisterType(typeof(NavAgentPathDTO), TypeAttribute.Empty(), new TypeTemplate
{
TemplatePath = TEMPLATE_PATH + "NavAgentPathSerializer.cs"
});
typeRegistry.RegisterType(typeof(ulong), TypeAttribute.Empty(), new TypeTemplate
{
TemplatePath = TEMPLATE_PATH + "ULongSerializer.cs"
});
}
}
Iād say it makes sense to make it public so that people can add their own templates.
Thanks!