question-mark
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.

[Feature Request]Reflection based atributes

See original GitHub issue

To bring this great project to a new level of freedom, we can add a bunch of reflection based attribute. The basic concept is use field/property/method name as attribute param, and use reflection to retrieve the value and decide how to draw.

For example:

public class DynamicShowIfAttribute : Attribute
{
	public string showMethod;
	public string enableMethod;

	public DynamicShowIfAttribute (string showMethod, string enableMethod = null)
	{
		this.showMethod = showMethod;
	}
}

public class Foo
{
	[DynamicShowIf (nameof (showVal), nameof (EnableValFunc))]
	public int val;

	bool showVal = true;
	bool ShowVal => true;

	bool EnableValFunc ()
	{
		return true;
	}
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jinsediaoyingcommented, Jul 2, 2021

A important use case is handle the class inheritance. For example, I usually put a help info box on top of my scripts. Without reflection based features, it is impossible to change that message in derived classes.

0reactions
arimgercommented, Aug 20, 2021

Hello,

from now, all condition drawers (EnableIf, HideIf, etc.) are able to use members of the parent class to pass values:

[DisableIf(nameof(GetFloatValue), 2.0f, Comparison = UnityComparisonMethod.GreaterEqual)]
public int var2;

public float GetFloatValue()
{
	return 1.6f;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Manage and Write Feature Requests?
Types of Feature Requests​​ They are a reflection of the user's needs, wants desires, and overall level of satisfaction with the product. The ......
Read more >
Customizing Feature Request and Feedback Attributes - Savio
The feature request status attribute tells you where in the development process a feature is. You can customize it so that it fits...
Read more >
Why You Need A Feature Request Tracking System
Most feature request tracking systems miss out on a key step in the process: understanding. They focus on delivering exactly what was requested,...
Read more >
5 Best Practices to Manage Product Feature Requests
Feature requests are a great way to get the entire community involved in your product and give them a sense of ownership.
Read more >
Reading Attributes with the Reflection API - Manual
This method returns an array of ReflectionAttribute instances that can be queried for attribute name, arguments and to instantiate an instance of the ......
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found