"UObject" has no member "BeginPlay"
That's because UObject
doesn't have a BeginPlay
member. BeginPlay
comes from AActor
.
It sounds like your bullet class just tries to inherit UObject
directly, instead of AActor
. If you want to make an actor subclass, your class needs to look like:
UCLASS()
class ABullet : public AActor {
...
}
Then you can implement BeginPlay
, and call it on instances of your ABullet
. User-error or possibly a bug in the C++ class creator in Unreal could have generated the type with the wrong base class as well, as it sounds like you didn't manually type it in.
Getting the error "immediately" suggests it's an error by the Intellisense parser, which... isn't really well suited to Unreal's massive codebase. It will often produce false positives and as such you may want to consider disabling the Intellisense feature that tries to pre-emptively pop-up errors and provide red squiggly underlines.
Unreal's unity compilation module will generally cause the headers for AActor
to be pulled in for you, but if you're not using the unity builds or if Intellisense still refuses to co-operate (since it will not understand the unity builds) you can sometimes appease it by explicitly adding an #include "AActor.h"
to the top of the file.