I want to set a variable value with the extension method for development purposes. There is a preprocessor instruction that runs in the dev environment and I want to have an option to test value in the shortest way while developing stuff. I plan to apply this to any generic type, assuming I know the types I work with, although type check wouldn't hurt.
So I try this extension method:
public static object ToEditorValue(this object value, object newValue)
{
#if UNITY_EDITOR
value = newValue;
#endif
return value;
}
And calling it like this does the job:
myInt = (int)myInt.ToEditorValue(2);
So the question is there a way to make the extension method so the calling one is minimal as
myInt.ToEditorValue(2);