Im trying to pass Type and reference to a generic via a string of the same name:
IE: string ButtonName == "ActionOne" ~~~~~>> Type == ActionOne, reference == ActionOne
Sadly I have no idea what the right syntax for this is, and am having a hard time finding it via google, so if someone knows how to do this, or at-least what it is called, it would help a huge amount!!
Thanks, and here is some sudo code of what i'm trying to do!
public class ActionPanelButton : *NotImportant* {
private string ButtonName;
private Type ButtonType;
void ActionPanelButton(){
ButtonName = this.Button.name; // This is return a string set by the user
ButtonType = Type.GetType(ButtonName);
ActionPanel = this.Button.parent.ActionPanel; // This will return the containing panel object
}
public void LeftClick(){ //This responds like any-ol OnClick
ActionPanel.ChangeSelectedActionBundle<(ButtonType)>(ActionPanel.DisplayedActionPanel.(ButtonType));
}
}
public class ActionPanel....
public void ChangeSelectedActionBundle <T> (T action){
Type typeOfObject = typeof(ActionBundle);
Type typeOfAction = typeof(T);
FieldInfo field = typeOfObject.GetField(typeOfAction.Name);
field.SetValue(SelectionManager.SelectedActionBundle, action);
}