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"

Custom component and existing blueprints

Hello,

Today I tried creating some custom components and ran intro a problem. This is how the class looks like:

 UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent))
 class TPS_API UTPSComponent_Shield : public USphereComponent
 {
     GENERATED_BODY()
         // CODE
 }

Nothing fancy really, no overriding or anything. Then I decided to add it to my character:

 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Skill, meta = (AllowPrivateAccess = "true"))
     class UTPSComponent_Shield* ShieldComponent;


and create it inside the constructor like this:

 ShieldComponent = CreateDefaultSubobject<UTPSComponent_Shield>(TEXT("Shield Component"));
     ShieldComponent->AttachTo(RootComponent);

In my game I have a blueprint that inherits from my character. Once I opened the blueprint I saw that my component is there but it was actually empty:

alt text

I found this thread on the forums that reported a similar issue:

https://forums.unrealengine.com/showthread.php?16514-Adding-custom-movement-component&p=95377&viewfull=1#post95377

I decided to try create a new blueprint that inherits from MyCharacter and see if it would work. Turns out, it solves the problems. Still it would be nice if this bug was fixed as recreating blueprints every time might be difficult and impractical.

alt text

Product Version: UE 4.8
Tags:
component_old.png (63.5 kB)
component_new.png (78.9 kB)
more ▼

asked Jun 23 '15 at 08:49 AM in Bug Reports

avatar image

Swiftle
109 16 26 32

avatar image kamrann Jun 23 '15 at 09:07 AM

It's a pity these issues still exist with 4.8, component problems like this have been around for ages and make it a real pain to develop c++ and blueprints concurrently. Your problem is very similar to one of those linked here, which was apparently fixed for 4.8.

avatar image Swiftle Jun 23 '15 at 09:29 AM

Sad to hear that indeed. I really like using both C++ and blueprints at the same time. C++ for the "heavy lifting", bluperints to quickly prototype new ideas and easily change data. I hope that those issues will be fixed eventually.

avatar image Doug E ♦♦ STAFF Jun 23 '15 at 08:29 PM

Hey Swiftle-

Can you explain in more detail how you're setting up your character and sphere component? I created a new character class and new sphere component class. After creating a blueprint based on the character class I added a pointer reference to the new sphere component based on the code you provided. After compiling the code (triggering a hot reload) the ShiledComponent showed up in the blueprint's Viewport and all of the properties in the details panel were editable except for the name which is expected since it is named in code.

Cheers

Doug Wilson

avatar image Swiftle Jun 24 '15 at 02:06 AM

Hey Doug,

The setup was as described above. I created a component and wanted to add it to my existing Character class. I had a blueprint that inherited from that class. When I added the pointer to the component inside .h and .cpp files the BP would have a null component.

The problem is that I just tried to reproduce the issue on a new project and couldn't do it.

  1. Started a new CPP TPS project.

  2. Deleted the default character BP and created my own

  3. Created my own Sphere Component class and added a pointer to it inside the Character .h and .cpp files.

  4. Everything worked fine even with the editor open.

Additionally I tried creating a Game Mode BP and setting it as default because I thought it might be related somehow but it wasn't the case.

Sorry that I can't help you further.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hey Swiftle-

Since you were able to work around this by creating a new blueprint and the issue cannot be reproduced in a new project would be possible for you to send me a copy of your project to investigate? If you can upload the project to dropbox you can send me a private message on the forums with a link to download if you would rather not post it publicly here.

Cheers

Doug Wilson

more ▼

answered Jun 24 '15 at 01:45 PM

avatar image Douglas Lassance Jun 26 '15 at 10:54 AM

I am also having this problem. Made a CPP custom component, each time I am changing something a little major, the component in the BP is broken. I have been recreating fresh BP each time so far but now it is really becoming unmanageable. I can give you something reproducible through PM if necessary.

avatar image Doug E ♦♦ STAFF Jun 26 '15 at 12:45 PM

Hey Douglas-

If you have a sample project experiencing this issue then please send me a PM on the forums with a link to download it. Additionally, does the same behavior exists on a new project as well?

avatar image Doug E ♦♦ STAFF Jul 01 '15 at 03:20 PM

Hey Swiftle-

I got the sample project you sent me on the forums and tested it out. After commenting out the lines that created the ShieldComponent in the TPSCharacter class and compiling the change I created a new blueprint based on the class and then uncommented and compiled again. When the ShieldComponent showed up on in the component list the options in the details panel were visible.

avatar image Swiftle Jul 02 '15 at 01:46 AM

Hi Doug,

Thanks for testing this out. Were you able to get it working in the existing blueprint or did you have to create a new one? I know it works when you create a new BP based on the class but I don't want to recreate my BPs each time I decide to add a component.

avatar image Doug E ♦♦ STAFF Jul 02 '15 at 06:16 PM

There is no TPSCharacter blueprint in the project by default. What I did test was commenting out the code that added the shield component to the character and compiled the code. I then created a blueprint from the TPSCharacter class which did not have a shield component on it. I uncommented the code to add the shield component and compiled again. When the compile finished the shield component was added to my TPSCharacter blueprint and was editable in the details panel. If I add the shield component to any of the bot blueprints available in the project then the details are also editable.

avatar image Swiftle Jul 03 '15 at 01:31 AM

Thanks for the explanation. I will try this again.

(comments are locked)
10|2000 characters needed characters left
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