Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

This 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:closed
  • Created 5 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

thestonefoxcommented, Nov 19, 2018

I just remembered. We need to make sure anything that extends UnityEngine.Object needs to get a ClearMyProperty() 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

public virtual void ClearMyProperty() {
  MyProperty = default(MyProperty.GetType());
bddckrcommented, Nov 19, 2018

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:

The approved types for an enum are byte, sbyte, short, ushort, int, uint, long, or ulong.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found