Giter VIP home page Giter VIP logo

Comments (8)

kekchpek avatar kekchpek commented on July 17, 2024 1

The workaround solution that works for me was add default constructor for all my non MonoBehaviour classes manualy, and add a Inject attribute for them. Also I did the same thing for some classes into Zenject.

from zenject.

TheAnosmic avatar TheAnosmic commented on July 17, 2024 1

I needed to add empty constructors with [Inject] to ZenjectManagersInstaller, SceneContextRegistryAdderAndRemover, SceneContextRegistry.
Android build with Mono, Unity 2020.3.3f1 with Zenject 9.20.

from zenject.

IvanM71 avatar IvanM71 commented on July 17, 2024 1

The code is probably erased (unused code is deleted) during the build. Usually this is code that is not called directly, but through reflection. This happens on the Inject attribute. It is necessary to look for something like Strip Code Level in the Project Setting -> Player -> Other settings and select the most minimal one or disable it altogether.

from zenject.

svermeulen avatar svermeulen commented on July 17, 2024

That's interesting, that sounds more like the kind of error you would get due to IL2CPP code-stripping, but you aren't using IL2CPP

from zenject.

svermeulen avatar svermeulen commented on July 17, 2024

I tried to reproduce this using the sample projects in both Unity 2019.1.0f2 and Unity 2018.3.12f1 but it worked as expected

from zenject.

realworld666 avatar realworld666 commented on July 17, 2024

I've updated to Extenject 8.0.1 and still getting the same error. Its definitely a Mono NET 4.5 build not IL2CPP. If it is code stripping, which I thought it might be, is there some way I can mark it as do not remove? There isn't actually a constructor defined in that class but I guess it should automatically be created

from zenject.

svermeulen avatar svermeulen commented on July 17, 2024

Yeah I remember getting that error in the past with IL2CPP sometimes. The workaround was to not only define a constructor but also add the [Inject] attribute. And since InjectAttribute inherits from PreserveAttribute, IL2CPP is guaranteed to not strip it. But I didn't think that workaround was necessary anymore since I thought constructors are included by default now. Also, I thought code stripping was only something that occurred with IL2CPP, so I can't really explain this. If you can provide a minimal example I can look into it further though

from zenject.

kekchpek avatar kekchpek commented on July 17, 2024

Any news about this issue?

from zenject.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.