Use code weaving
See original GitHub issueThis will solve our API accessibility issue when using UnityEvent’s inspector to wire things up.
if private field X has [Tooltip] attribute
then create public Property X
if found method ConfigureX
then add ConfigureX to end of Property X.setter
and create OnValidate add ConfigureX to OnValidate
if Property is descendant of `UnityEngine.Object`
then add `ClearX()` method which sets field to `Default(T)`
if Property is a collection
then add `ClearX()` method which calls x.Clear()
If Property is "sub class"
then add `ClearX()` method which sets sub class to `Default("sub class")`
ConfigureX
here can optionally return T
to change the value we set in the property setter. This allows clamping values for example.
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (17 by maintainers)
Top Results From Across the Web
What is IL Weaving?
IL Weaving is basically analyzing and altering the intermediate language. Since it is done at that level it can be done for all...
Read more >Weaving Codes
"Weaving Codes – coding weaves" was a collaboration between FoAM Kernow (now called Then Try This), Alex McLean at the University of Leeds, ......
Read more >Code Weaving in .NET using Fody
This process of injecting code post compilation directly into generated intermediate language is known as .NET assembly weaving or IL weaving (similar to...
Read more >Weaving codes – coding weaves
The concept is to combine programming with physical objects, concentrating on sensor input and movement as output. It's important that we ...
Read more >Weaving in Code for the 19th Amendment
Soon they will be a shawl! Codes, and especially secret codes, are intriguing. You may have read about knitters using their craft during...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just remembered. We need to make sure anything that extends
UnityEngine.Object
needs to get aClearMyProperty()
method that sets it to null because you can’t clear then via the UnityEvent otherwise.Or we could make it easier and everything gets a
Hmm. I’d love to support things like that (and vectors!) that aren’t supported by Unity as constants there.
Such a method doesn’t help us, though? Users don’t really know the enum values in advance and for bitfields it would be even harder for them.
Besides us having to support all backing types: