- Home /
How to make a custom class inherited from Unity's GUI?
Hello, Thank you for taking the time to look at this. The issue I'm having is this:
I'm trying to make my GUI navigable by means of an Xbox controller. To do this I've decided to try making a custom button class that will be inherited from the default Unity GUI.Button class, but hold an extra integer variable that I can assign different buttons so that I may store them in an array, then allow the current one to change based on controller input , etc., etc,
The issue I seem to be having trying to actually do this is that I cannot find (or just lack the knowledge) a way to implement this. I'm not overly familiar with the concept of Inheritance in classes. I've watched a few tutorials for this, and gained some insight on approximately what I need to do, but I'm still a bit fuzzy. I've searched google for a solution to this problem, but to little avail. This appears to be exactly what I need, however I'm having a difficult time understanding what's going on in his code, and how to implement that in such a way that it fits my needs.
This is the code I have created thus far :P, I'm almost certain I'm doing this wrong. Any explanation or help you may be able to provide, I would be greatly appreciative! (If not already apparent, I'm using C#)
public class CustomButton : GUI {
public bool Clicked;
public Rect rect;
public GUIContent Content;
public GUIStyle Style;
public int ButtonID;
}
Your answer
Follow this Question
Related Questions
An OS design issue: File types associated with their appropriate programs 1 Answer
C# Conception - Hide inherited members and functions 1 Answer
Is there a way to use ScaleMode.Scaletofit on buttons? 0 Answers
GUI: Button: C#: Use method which has a parameter that does not derive from MonoBehaviour 0 Answers