Rename networking codegen initializer to NetworkingPlugin for C# netcode

This commit is contained in:
Wojtek Figat
2023-04-15 12:05:33 +02:00
parent e4804db160
commit 2d51332bf7

View File

@@ -573,10 +573,9 @@ namespace Flax.Build.Plugins
if (context.AddSerializers.Count != 0 || context.MethodRPCs.Count != 0)
{
// Create class
var name = "Initializer";
var idx = 0;
while (module.Types.Any(x => x.Name == name))
name = "Initializer" + idx++;
var name = "NetworkingPlugin";
if (module.Types.Any(x => x.Name == name))
throw new Exception($"Failed to generate network replication for assembly '{Path.GetFileName(assemblyPath)}' that already has net code generated. Rebuild project.");
var c = new TypeDefinition("", name, TypeAttributes.Class | TypeAttributes.AutoLayout | TypeAttributes.AnsiClass | TypeAttributes.Abstract | TypeAttributes.Sealed | TypeAttributes.BeforeFieldInit);
module.GetType("System.Object", out var objectType);
c.BaseType = module.ImportReference(objectType);