I am optionally display some content in the Unity Editor based on options chosen for a given component, this will be used when displaying a summary of options chosen on this current Component.
How I can make a function inline that returns a string, I want this function to be inline because there will be many of these and they will only useful in the line they are used in.
I have provided a code snippet that may clarify what I am trying to do.
I have used lambda functions like this in c++ and JavaScript, but not in c# and I've tried finding an answer on how to use them like this in C#.
var script = target as ButtonManager;//get reference to this Component
EditorGUILayout.LabelField("Your current Interactive configuration",
"Parent: " + script.sceneParent.name + "\n",
"Popup? " + ()=>{ if (script.isPopup) { return "Popup" } else { return "Change Scene"} }
+ "\n"
);
Edit: I can use a ternary operator to solve this problem, but I am curious as to how this would work with lambda functions.