x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I resolve the error "Unrecognized type 'TSubobjectPtr'" while generating code?

I'm experiencing an error during the code generation phase of building my project. I added an actor via the UE4.1 C++ wizard, named AProjectileBasicExplosion. Following the first person template for Projectile.h, I created the following header file:

 #pragma once
 
 #include "GameFramework/Actor.h"
 #include "ProjectileBasicExplosion.generated.h"
 
 /**
  * Explosion actor
  */
 UCLASS(config=Game)
 class AProjectileBasicExplosion : public AActor
 {
     GENERATED_UCLASS_BODY()
 
     /** Explosion Particle Component */
     UPROPERTY(VisibleAnywhere, Category=Particle)
     TSubobjectPtr<ParticleSystemComponent> ExplosionParticles;
      
     /** Force Component */
     UPROPERTY(VisibleAnywhere, Category=Force)
     TSubobjectPtr<RadialForceComponent> ExplosionForce;
 
     UFUNCTION()
     void Explode();
 };

Upon compiling, I receive the following failure:

 1>------ Rebuild All started: Project: FugitiveRush, Configuration: Development_Editor x64 ------
 1>  Cleaning FugitiveRushEditor Binaries...
 1>  Parsing headers for FugitiveRushEditor
 1>C:/Users/Axel/Documents/Unreal Projects/FugitiveRush/Source/FugitiveRush/ProjectileBasicExplosion.h(18): error : In ProjectileBasicExplosion: Unrecognized type 'TSubobjectPtr'
 1>Error : Failed to generate code for FugitiveRushEditor - error code: 4
 1>EXEC : error : UnrealHeaderTool failed for target 'FugitiveRushEditor' (platform: Win64, module info: C:\Users\Axel\Documents\Unreal Projects\FugitiveRush\Intermediate\Build\Win64\FugitiveRushEditor\Development\UnrealHeaderTool.manifest).
 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(43,5): error MSB3073: The command ""C:\Program Files\Unreal Engine\4.1\Engine\Build\BatchFiles\Rebuild.bat" FugitiveRushEditor Win64 Development "C:\Users\Axel\Documents\Unreal Projects\FugitiveRush\FugitiveRush.uproject" -rocket" exited with code 1.
 ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

It seems that TSubobjectPtr is defined in Runtime/CoreUObject/Public/UObject/UObjectGlobals.h, however since it is not included in the Projectile.h template, I assume that this header file is included in either the .generated.h file or more likely the Actor.h file. I've read the manual, but it hasn't cleared up my issue. So I guess my question is twofold:

  1. How can I fix this error message, and what am I doing wrong?

  2. Are there implicit dependencies within the first person template project files? Why does the generated file for ProjectileBasicExplosion.h need to include Actor.h while the template file Projectile.h not? If so, what are they and where are they configured?

Thanks for the help.

Product Version: Not Selected
Tags:
more ▼

asked Jun 01 '14 at 01:05 AM in C++ Programming

avatar image

axelmagn
6 2 3 6

avatar image Shadowriver Jun 01 '14 at 01:10 AM

Why VisibleAnywhere? Component will be always visible in component editor regardless what specifier you gonna use.

avatar image axelmagn Jun 01 '14 at 01:16 AM

I didn't realize that. I saw it in the other template and it seemed like a straightforward way to make it configurable in the editor. Do you think it is related to the issue?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Try changing your TSubobjectPtr< ParticleSystemComponent > to TSubobjectPtr< UParticleSystemComponent > and same thing with the RadialForceComponent (Don't forget the U)

And if that still doesn't work, then change it to TSubobjectPtr< class UParticleSystemComponent > and same with RadialForceComponent. One of those should work.

more ▼

answered Jun 01 '14 at 02:55 AM

avatar image

Ehamloptiran
1.5k 50 9 59

avatar image axelmagn Jun 01 '14 at 03:27 AM

Thanks! That did the trick.

avatar image axelmagn Jun 01 '14 at 03:27 AM

Also I feed silly now.

avatar image Ehamloptiran Jun 01 '14 at 03:50 AM

No worries, no need to feel silly. We are all learning here, I can say that I have made the same mistake numerous times now and probably even sillier mistakes :P

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question