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"

component being set to null after change

hello, having a character set up in c++, i added a c++ component to it and initialized it in the constructor.

i.e: SkillCastingComponent = CreateDefaultSubobject<USkillCastingComponent>(TEXT("SkillCastingComponent"));

the character is inherited in a blueprint.

Today i change few of the properties inside this component and built the project using VS. after the build was successful, the output log in the editor pointed a warning the the reference will be nullptred and indeed, inside the blueprint derived from the character, the component's details window is empty, and starting the game will cause a crash stating that SkillCastingComponent is null.

this is not the first time it happens. in the first time it happened i deleted the character blueprint and created a new one. in the rest of the times i changed the property name (i.e from SkillCastingComponent to SkillCastingComponent2) and it worked.

i cant keep doing this cause as you imagine, it will mess up the references inside the blueprint. is there any way to avoid this?

Product Version: UE 4.20
Tags:
more ▼

asked Dec 11 '18 at 04:03 PM in C++ Programming

avatar image

Kidakaka
17 1 4 7

avatar image Brian Johnstone Dec 14 '18 at 07:34 PM

How is your component SkillCastingComponent declared in your .h file? Is it a UPROPERTY and what settings do you use for that UPROPERTY?

avatar image Kidakaka Dec 14 '18 at 07:55 PM

thank you for replying.

 UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
 class GAMEPROTOTYPE_API USkillCastingComponent : public UActorComponent


and in the character class:

     /** Skill Casting Component */
     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Custom, meta = (AllowPrivateAccess = "true"))
     class USkillCastingComponent* SkillCastinggComponent;


avatar image Kidakaka Feb 23 '19 at 12:57 PM

still an issue all this time and i didnt find a solution

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

1 answer: sort voted first

It happened to me several times too. This is the problem of hot reload and whenever you edit a serialized data (UPROPERTY or UFUNCTION) in C++ there's a chance for hot reload going wrong.

My way to avoid it is just being extra cautious when dealing with serialized data. For example closing the editor before compiling if the code involves UPROPERTY changes. Make separated commits for code and binaries.

Also if you can reproduce the issue consistently you should just send a bug report to Epic and let the engine team fix it.

more ▼

answered Feb 24 '19 at 11:27 AM

avatar image

madturtleGGinin
346 1 4 4

(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