Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

410
Vistas
Unity script won't update after first successful weaving with Mono.Cecil

I'm using Mono.Cecil to modify assemblies post compilation within Unity (I'm using this implementation of Mono.Cecil). For some reason, if I add a field to a type in an assembly, and the type of the field is a delegate type that I've defined, scripts in the assembly don't appear to update after the first successful modification/weaving.

The following code runs correctly every time I recompile, but if I attempt to replace PropertyChangedEventHandler with a custom delegate type, the assembly compiles and weaves correctly only once, then refuses to compile/update with newer script changes. It only works again if I restart Unity. I'm not receiving any error messages:

var handlerReference = typeDefinition.Module.ImportReference(typeof(System.ComponentModel.PropertyChangedEventHandler));
 
var fieldDef = new FieldDefinition(nameof(INotifyMethodCalled.MethodCalled), FieldAttributes.Private | FieldAttributes.NotSerialized, handlerReference);

typeDefinition.Fields.Add(fieldDef);

Any help would be greatly appreciated.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I just resolved my issue--the script doing the weaving was referencing the assembly it was weaving. This was the programmatic equivalent of a snake eating its tail and choking on it. The script using Mono.Cecil no longer references its target assembly.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda