i’m trying to do something like this:
tabs.addTab(new Tab("Test1")
{
public override void OnGUI()
{
//My code here
}
});
I have done this many times on java (override a function when creating the object) , but now i’m using Unity with C# , and i’m trying to find how to do it or its equivalent .
Thanks for reading , Any idea?
I’m not sure if C# allows you to override methods when creating a new object, but you could use delegates instead.
A delegate is a variable that stores a function for its value. Something like this should do more or less what you are looking for