Comments (8)
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.
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.
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.
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.
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.
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.
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.
Any news about this issue?
from zenject.
Related Issues (20)
- ZenjectIntegrationTestFixture.Setup destroys objects that prevent UnityTests from running.
- Link Checker Report
- [Doc Bug] Broken link in Readme.md for example of using multiscene setups
- Failed to remove SceneContext from SceneContextRegistry HOT 1
- Circular Dependencies
- Unused sample zenject scripts in build (IL2CPP and Zenject)
- NullReferenceException when second time inject HOT 1
- working with additive scenes? HOT 1
- i need to declare many signals. is there a solution for that? HOT 1
- [Zenject 6 Upgrade] Not possible to bind multiple interfaces to the same implementation when using WithId anymore?
- There is no DisposableManager.RemoveLate method for removing previously registrated objects.
- Prefab installer ignore bind FromInstance
- Passing dynamic data + prefab through method Create (Factory) while that prefab has GameObjectContext HOT 1
- The type or namespace name 'ConstructorChoiceStrategy' could not be found while building NonUnityBuild solution
- "Re-injecting" dependencies into a prefab when it's spawned from a MemoryPool? HOT 1
- Project Context: "Null Installer" assert hit when using Prefab Variant only on built version
- MemoryPool<Param, Value> with CustomFactory HOT 1
- When using Container.Instantiate to create a new object in the Create method of the factory, IMemoryPool is not assigned.
- [question] Is generic installers possible?
- Inquiry Regarding IDisposable in Zenject
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zenject.