Search Unity

Question Find out what could cause C2440 when building to IL2CPP

Discussion in 'Windows' started by Hertzole, Jun 4, 2021.

  1. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Hello

    I'm trying to build my game using IL2CPP but I get a
    C2440: 'type cast': cannot convert from 'Type_XXX *' to 'Type_YYY'
    exception. Now, this might just be a Unity thing but most likely not. I'm doing code weaving in this project and it will be incredibly difficult to track down exactly where this issue occurs. Is there some way I could track this down better than just removing parts of my very interconnected weaving and hope for the best?

    EDIT: I should add that I'm using Unity 2020.3.10 and the very undocumented ILPostProcessor + Mono.Cecil for my weaving.
     
  2. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    Hello @Hertzole ,
    I'm getting the same error message during build on Unity 2022.3.10f. Did you find a solution to this issue?

    Many thanks