I am trying to create a sort of guard-like AI character for a school assignment. I did it once using blueprints, but unfortuantely we are not allowed to use blueprints, only C++. In blueprints I used a function called “OnSeePawn” which I can see is used in C++ but I don’t know which file to use it in. I have never seen a .h and .cpp before. The C++ I used was just all one file. You would declare all your variables and stuff then make classes, functions, or whatever. To make a long question short, what is a .cpp and .h file. I know .h is a header file but what exactly is that? What do you use in a header that you don’t use in a cpp?
That is the documentation that I am trying to use if you want to base your answer off these functions and stuff.
In header files you declare classes and methods, which you implement in a .cpp file. You can include header files and should never include a .cpp file. Modifying a single header file means everything will have to be recompiled. Modifying a single .cpp file does not. In a header you can (often) forward declare classes you are going to use without actually using "include …h’ this improves compile time. In the .cpp file where you actually implement things you should then include the headers of the forward declared classes.