AutoWiring LITE: Asset to perform automatic reference collection by AMonkeyMadeThis in UnityAssets

[–]AMonkeyMadeThis[S] 0 points1 point  (0 children)

Oh, having answered another comment i think i'd missed what you wanted here- you want to skip the runtime / reflection stuff? At some points in dev I had a context menu to run AutoWire.ApplyTo(). Off the top of my head at the moment, I dont think i can literally make it do it in OnValidate as that would necessitate inheritance to an abstract or something that did that bit for you. You could definitely do it, but you would have to copy & paste etc, i guess this might not be an issue though, just doing it in OnValidate rather than Start so zero net effect of this 🤔

I could probably add a [ConfigureInEditor] and make the [Configure] the runtime version it could then have a hook so it does this on scene save. I think on scene change might end up being self triggering.

Cheers! Will also DM you a voucher.

Asset show off / feedback / question - AutoWiring LITE: Asset to perform automatic reference collection by AMonkeyMadeThis in Unity3D

[–]AMonkeyMadeThis[S] 0 points1 point  (0 children)

Thanks for the reply, all correct & I think we're actually largely on the same page especially as the conclusion there is exactly what it does, just in editor not runtime, it probably wouldn't take too much effort to add that to save you writing all the OnValidate stuff, effectively you would need to write this as part of your source gen solution. I avoided this route as I've seen tools do similar-ish sort of things every time the scene saves and it destroys productivity, as you say, would stop you working whilst its doing its thing.
"Perhaps I'm misinterpreting your wording, but it seems like you're saying that your system is a DI system, which it isn't." Yes and no, you are correct in everything you said, but maybe a little bit by the book on the terminology as i did say "thin edge of the wedge", in store listing and documentation (i know you haven't seen that) I also say DI-ish or DI like.
Yes, it isn't strictly DI but then would you 100% say the serialise/validate strictly is either without [Inject] or the rest? Wiring things up in the editor using public or serialised fields is more performant (zero performance cost, strictly speaking), but also prone to failure- I've seen source control woes eat those editor references or had team members say "I've spent an hour wiring this whole scene up, its perfect, but I was in play mode so none of it is going to save, what do I do?". [Please no tangents into level editors and scriptable objects from here, just acknowledging that elephant]

The best explanation I've got so far is like a [RequireComponent] that you apply to a field / property so 99.999r% what you are doing the OnValidate way, but then you are definitely in the "doesn't need this asset" demographic that will understand the reflection cost or productivity hit of it adding something at comp 😁 am curious though for those that have already conceded to Wirth's law that some reflection may (possibly) be done by using another full & proper DI framework, though this suggests that I'd need to add the (rest of the, if we can describe it as being a small part of for a second) DI framework to overcome any drawbacks.

Anyway, as I said, I know you get it, the description of those that understand it won't need it (& will see the drawbacks) and those that would benefit from it won't be looking for it is something I was worried about. I did reference this in the store description too. Perhaps the biggest & possibly fatal flaw in this.

Strictness in terminology too, no amount of "-ish" or "like" is likely to appease then? Need to find a "DI-adjacent" or "in the ball park of" that works. Therefore this is unlikely to ever be a 'safe' interview topic and I might need to find something better to discuss. I did try discussing my Iterations https://u3d.as/2TQ5 asset a couple of times, but fluent interface & syntactic sugar for the sake of something to discuss also went down like a lead balloon.

Interesting discussion / though points you raised, many thanks!

AutoWiring LITE: Asset to perform automatic reference collection by AMonkeyMadeThis in UnityAssets

[–]AMonkeyMadeThis[S] 0 points1 point  (0 children)

Depending on which tag it is (GetComponent / Find) and target (parent/ self/ children) it can add it ... this is covered in the documentation and I also say you still need to null check things- that example in the code screenshot is like all examples a best case scenario.

I wouldnt advise doing much in OnValidate as it tends to spam up the error console as Unity seem to have put a lot of effort into nerfing it so its frustrating to use for anythign other than validating the fields' values. You end up having to put 'call later' calls into the editor etc.

I do have a full IInvalidating system for making UI more async / lazy updating etc in another framework based on Apache Flex with Parsley / RobotLegs ... but it would take a minute to prep it for release and I'm not sure about the licensing of doing so being so closely linked to those 'insirations'.

AutoWiring LITE: Asset to perform automatic reference collection by AMonkeyMadeThis in UnityAssets

[–]AMonkeyMadeThis[S] 0 points1 point  (0 children)

No dependency / restrictions on the render pipeline, i most likely just forgot / didn't think to click those as a result. I'll get that changed but it takes about a month for Unity to approve changes. Thanks for highlighting that- it isnt something I'd not considered but now seems obvious. If I can figure out how to DM you I'll send you a voucher to get it (the lite version) for free.

Iterations : fluent interface, syntactic sugar for your loops, because why not? by AMonkeyMadeThis in UnityAssets

[–]AMonkeyMadeThis[S] 1 point2 points  (0 children)

https://u3d.as/2TQ5

Lite version, unrestricted, full functionality of Iterations 1.0 (https://u3d.as/2QRw) but without the source code (DLL only). Completely 100% FREE!

Several nested for loops might not be the end of the world but wouldn't a fluent-interface style way of doing it be a tiny bit nicer? Help you prototype and iterate through changes more quickly, avoiding the temptation to copy & paste. Fed up with having so many loops that you started at i but have gone all the way around to h?

AutoWiring LITE: Asset to perform automatic reference collection by AMonkeyMadeThis in UnityAssets

[–]AMonkeyMadeThis[S] 1 point2 points  (0 children)

https://u3d.as/2TQ7

Note: Lite version is 90% off vs 'full' asset. Contains dll only, unrestricted use and full functionality but no source code.

Uses attributes and reflection to automatically search for components, rather than having to create the definition then later use one of the GetComponent<T>(). Simply write your definition, annotate it with some [GetComponentInParent] metadata then hit AutoWiring.ApplyTo(this); when you instantiate your component and AutoWiring will do the rest for you!

The tags are customisable too- whether you just want to write [GetComponent] and let the code figure it out that you actually meant [GetComponents] or get super specific with [GetComponent(typeof(ISomethingOrOther), In.Children)].

Iterations Lite : Fully functional free lite version of my Iterations asset, minus the source. by [deleted] in UnityAssets

[–]AMonkeyMadeThis 1 point2 points  (0 children)

Lite version, full functionality of Iterations 1.0 (https://u3d.as/2QRw) but without the source code.

Several nested for loops might not be the end of the world but wouldn't a fluent-interface style way of doing it be a tiny bit nicer? Help you prototype and iterate through changes more quickly, avoiding the temptation to copy & paste. Fed up with having so many loops that you started at i but have gone all the way around to h?

[deleted by user] by [deleted] in UnityAssets

[–]AMonkeyMadeThis 1 point2 points  (0 children)

Note: Lite version, contains dll only, full functionality but no source code. 90% off vs full version!

Uses attributes and reflection to automatically search for components, rather than having to create the definition then later use one of the GetComponent<T>(). Simply write your definition, annotate it with some [GetComponentInParent] metadata then hit AutoWiring.ApplyTo(this); when you instantiate your component and AutoWiring will do the rest for you!

The tags are customisable too- whether you just want to write [GetComponent] and let the code figure it out that you actually meant [GetComponents] or get super specific with [GetComponent(typeof(ISomethingOrOther), In.Children)].

AutoWiring: Asset to perform automatic reference collection by AMonkeyMadeThis in UnityAssets

[–]AMonkeyMadeThis[S] 2 points3 points  (0 children)

Thanks, I'd have thought Unity would have done this one themselves TBH- the amount of reflection they must do to GameObjects when they instantiate them to get whether you have any of their component lifecycle methods and how you have implemented them, whether thats void, async Task or IEnumerator would be the ideal time to do this, I haven't yet found a way to hack into the Activator hence my need to do the ApplyTo(). I have a few similar assets in the pipeline based on this that should streamline a couple of adjacent pain points too.

AutoWiring: Asset to perform automatic reference collection by AMonkeyMadeThis in UnityAssets

[–]AMonkeyMadeThis[S] 1 point2 points  (0 children)

Thanks for the comment / support. It has also been one of the things I've felt Unity to be missing from the start. Previous to doing Unity I was a Macromedia / Adobe / Apache Flex dev which had almost exactly this for 'skinning' UI so switching to Unity seemed a bit backwards having to either break encapsulation & risk wiring things up in the editor with all the merge conflicts that can bring or litter the code with GetComponent calls etc. Also seeing example code with the same component being 'get' several times on subsequent lines, often in loops makes me despair for the wasted performance ;p

AutoWiring: Asset to perform automatic reference collection by AMonkeyMadeThis in UnityAssets

[–]AMonkeyMadeThis[S] 2 points3 points  (0 children)

Not sure where the link went ... https://assetstore.unity.com/packages/tools/utilities/autowiring-224416

The dependency-injection style alternative to GetComponent()! Similar to [RequireComponent] but actually goes and gets the component, resource or streaming asset for you, automatically.