Use variables from parent class without needing to re-define them in child class

I have a class which has references to game objects, scripts, etc. I also have a class which inherits from this class. When I try to use variables from the parent class in the child class I get an error because I haven’t defined them again in the child class. Is there a way to get around this?

How did you define your variables in your patent class? Keep in mind that private variables are only visible to the class itself. They exist in derived classes but are not accessible.

In order to have access to variables defined in the parent class from a derived class they need to be either protected or public.

protected variables are only visible to the class itself or from inside any derived class. From outside the class they are not visible just like private variables. Public variables are generally accessible even from outside the class

Like the comments already mentioned we can’t tell you what you should do or what exactly you did wrong without seeing the code or without knowing the exact compiler error you get.