Your generator may get its fuel from the RV's gas tank. If it does, the generator gets its fuel from a pipe that has its lower end a bout two inches from the bottom of the tank. When the fuel goes below that level, the generator runs out of fuel, but there is gas left for the RV engine to start and get to a gas station.
Another guess is that the generator electric shut off valve is stuck closed. You can find it by looking at the carburetor. If there are wires going to it, the shut off valve is at the end of the wires and be in the path of your gas line. It should unscrew from the carburetor. Disassemble the valve and clean it. After cleaning, the small cylinder should be spring loaded and move easily. The valve operates by a electric magnet that causes the valve to open and close. After cleaning, reassemble it, and it should work.