apkd / medicine Goto Github PK
View Code? Open in Web Editor NEWCode-driven component injection toolkit for Unity.
License: Creative Commons Attribution 4.0 International
Code-driven component injection toolkit for Unity.
License: Creative Commons Attribution 4.0 International
I was using Medicine's Inject.Single
on abstract MonoBehaviours
today, and it warned me about it not being an auto-implemented property. I did compare that line with other Inject.Single
properties elsewhere in the project but I wasn't able to tell the difference. Maybe there's something wrong with using it in abstract classes (?)
Code:
ItemBehaviour.cs:
public abstract class ItemBehaviour<TReference> : MonoBehaviour where TReference : Item
{
[Inject.Single] // << warning Property RenderManager RenderManager needs to be an auto-implemented property to use injection. For example: (No example given)
protected RenderManager RenderManager { get; }
}
RenderManager.cs:
[Register.Single]
public class RenderManager : MonoBehaviour
Thank you!
I find myself wanting injection to happen to some extent during edit mode, for setting things up correctly in OnValidate(), or just for use in editor scripts.
[Inject] public BoxCollider Box { get; }
void OnValidate()
{
Box.isTrigger = true;
}
I do understand why this doesn't currently work, and I can't think of any super elegant solution off the top of my head.
I thought I'd mention it as something that'd be desirable on the off-chance there's a great way to support this that doesn't create loads of edge cases.
The docs are a mess. Maybe move parts of readme to the wiki?...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.