Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

419
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda