Sorry for the stupid question but what would be the way to pass the actual class property in an argument so I can set generic class properties from inside a function, here is the example:
// I don't know how to pass the actual refrence of Bar.property1 or
// Bar.property2 like a pointer to the value like in C++
// Bar bar = new Bar()
// Foo (bar.property1);
// Foo (bar.property2);
public void Foo(Bar property)
{
// How to set the actual value of property1 in Bar? from the argument?
// So that a property in the Bar class will be set to 5.
property = 5f;
}
public class Bar : MonoBehaviour
{
public float property1;
public float property2;
}
I don’t want to set it like this:
public void Foo(float property)
{
Bar bar = new Bar();
bar.property1 = 5f;
}
Because I am creating a dynamic GUI system that calls for this.
Thanks for taking the time to read this!