![]() ![]() If it does, then it will set the variables however it sets them. The question is whether that function gets executed. Or zero instances of the parent class.īut what you should be asking about is the Awake() function, not the variables. You could have 10 instances of the parent class that all have different values for the same variables. ![]() Variables values are related to an instance of a class, not to the class itself, so they couldn't possibly be inherited. When calling IsMouseOutsideDeadzone in Update in the parent class, I get what I'm expecting however when calling IsMouseOutsideDeadzone in the child class, while transform.position and mousePos return the right amounts, all the variables created in the parent class set in Awake return 0. To be more specific, in the parent class, IsMouseOutsideDeadzone() compares mousePos to a transform.position x and y values + or - deadzoneXHalf or deadzoneYHalf. (The exceptions are transform.position and mousePos mentioned above mousePos is running in the parent class' Update method edit: mousePos is static, I forgot) I have access to the variable names+types inside the child class but not the amounts set in the parent class. However, inside the child class, the float and Vector2 variables (which, in the parent class, had values applied to them) are set to 0. In this child class I can access the inherited variables and methods - "horzExtent", "deadzoneHalves", IsMouseOutsideDeadzone() method, etc. I have a child class which inherits from the parent class. In a parent class, I have a method that compares some float and Vector2 positions/amounts (set in the Awake method, aside from transform.position and mouse position/mousePos) in world space to see if the mouse is outside a certain area (IsMouseOutsideDeadzone(), returning true or false). (sorry if I don't use all the appropriate technical terms) This is just something I'm curious about. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |