Ok. Here is exact replication of the issue:
-
Use Add Code to Project.
-
Add any classes based on UObject.
-
Now add some properties the new classes.
-
Now try to use these new classes inside other code files.
-
Not working! identifier is undeclared
It works when you create new class trough Add Code to Project that inherit from AActor.
It’s not that big of deal, because I can always include all the files manually inside files that need them. But it is bit inconvenient to do so, and more over it is simply inconsistent with the rest of the system.
Hi Lukaz,
Just for clarification are you referring to the need to have #include in your code file that references other classes you have made?
Thanks
Yes. To be absolutely clear I have a Class:
UCLASS()
class URPGDeleteMe : public UObject
Which if defined inside RPGDeleteMe.h
Now I declared:
UCLASS(config=Game)
class ARPGCharacter : public ACharacter
{
GENERATED_UCLASS_BODY()
URPGDeleteMe* omgPointer;
};
Rebuild All.
Missing Type Specifier. Once I add include that RPGDeleteMe.h inside RPGCharacter.h it’s working.
It’s fresh class added trough Add Code to Project.
I have the same problem with:
class URPGEffectManagerComponent : public UActorComponent
I can’t add it in character class:
TSubobjectPtr EffectManager;
Unless I include it’s header file.
Although I had this problem earlier, with different class:
class URPGEffectBase : public UObject
it is now working. I will try to investigate it further.
It is not a bug that #include is necessary to access different classes in code files. Otherwise compile times would be much larger.
Cheers