UPostProcessComponent is null - Unreal VR Dev Section 1-15

Hello.

I’m stuck at this section (1-15: Dynamic Material Instances), it looks like the UPostProcessComponent I intent to use is always null, I checked the video multiple times and I can’t find what could be the reason for it to be null.

Header file looks like this

UPROPERTY()
class UPostProcessComponent* PostProcessComponent;

CPP file looks like this

AVRCharacter::AVRCharacter()
{

PrimaryActorTick.bCanEverTick = true;

VRRoot = CreateDefaultSubobject<USceneComponent>(TEXT("VRRoot"));

VRRoot->SetupAttachment(GetRootComponent());

Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));

Camera->SetupAttachment(VRRoot);

DestinationMarker = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("DestinationMarker"));

DestinationMarker->SetupAttachment(GetRootComponent());

PostProcessComponent = CreateDefaultSubobject<UPostProcessComponent>(TEXT("PostProcessComponent"));

PostProcessComponent->SetupAttachment(GetRootComponent());

}

BeginPlay event inside CPP file looks like this:

void AVRCharacter::BeginPlay()

{

Super::BeginPlay();

DestinationMarker->SetVisibility(false);

if(BlinkerMaterialBase != nullptr)

{

    BlinkerMaterialInstance = UMaterialInstanceDynamic::Create(BlinkerMaterialBase, this);

    if(PostProcessComponent != nullptr)

    {

        UE_LOG(LogTemp, Warning, TEXT("PostProcess Is not null"));

        PostProcessComponent->AddOrUpdateBlendable(BlinkerMaterialInstance);

        BlinkerMaterialInstance->SetScalarParameterValue(TEXT("Radius"), 0.2);

    }

    else

    {

        UE_LOG(LogTemp, Warning, TEXT("Is null"));

    }

}

}

Game was crashing without checking if PostProcessComponent was null, everything was working so fine until this point, the post process was working just fine before the dynamic code, the output log looks like this:

LogTemp: Warning: Is null

I would really appreciate any help you can provide :slight_smile: my UE version is 4.26.2.

Thank you so much!

I found someone in Udemy Q&A that had the same problem a year ago and the solution was to downgrade UE to 4.24, I tried that but since all the assets are newer the map and bp are no longer working.

You could also try refreshing the blueprint. Sometimes they can cache the wrong value. Right click the blueprint > asset actions > reload.

Hi Sam! I tried reloading the blueprint like you suggested but didn’t work :frowning:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Hi There. Did you ever figure out what was going on? Could you confirm the version of UE you’re using as well so I can try it out. Have you tried the Code from end of lecture to see if it works?

Thanks.

Hello beegeedee! no :frowning: I still can’t find out what could be wrong, my UE Version is 4.26, I tried the code as it is in the video but with that I get the null value. I read it’s probably something with that specific distribution, since another person said that downgrading the UE version should work.

I’m still very new in this UE stuff so I’m very confused :frowning: I stopped the course because of this. I thank you so much for your help!

1 Like

It’s unfortunate. I checked with 4.26 myself yesterday - I recently restarted the project and while there are differences, the postprocessing component worked in 4.26. If you do want to continue with the course, let me know and I can share a project that you can try. If it works, you could perhaps continue with this project? I have it in a git repository so I can save a zip and share with you if you want.

Thanks.

Also, If there’s anything I can do to help you get back on track, please let me know.

Hello! Of course I want to continue the course and I will be very grateful if you could share your code with me! maybe I made a mistake somewhere and I can correct it while studying yours! :slight_smile: I could share my main CPP and Header files with you too, like I was saying right until the section 1-15 everything was working just fine and exactly like in the videos, I was following along just fine but that null was very frustrating :frowning:

Thank you so much!

Ok, I’ve shared the project here: https://drive.google.com/file/d/1ET1f0-RnKcMBi2ZjEo1teZAQTeoZXeB6/view?usp=sharing

This includes everything, even the archvis assets so theoretically it should be a matter of opening and running.

Let me know when you’ve got the project so I can remove it again. I really hope this works. If you can zip the source folder and share, I can take a look at that for you.

Thank you so much! I requested access to the files with my hotmail account :slight_smile: b*****e, sorry for the delay, I had tons of work but I’ll be checking them on the weekend!

Ok. You should have access now.

All right! I downloaded the files so you can remove them :slight_smile: I’ll upload mine so I can share them with you, I really appreciate your help beegeedee !!!

If you need any more help, just post here.

I uploaded my entire project to gdrive, here is the link: https://drive.google.com/file/d/1vdO5X7UGLJlpW3S3PxjRJhd1Jfj97gHz/view?usp=sharing , this is before checking yours :slight_smile: so maybe we can find what went wrong, thank you!!!

Got it, thanks. I’ll take a look and see if I can spot anything

1 Like

Hi Max,
Figured it out. The Post Process Component wasn’t showing even in BP_VRCharacter so I changed to VisibleAnywhere so I could see it.

This still didn’t show.
I then edited the Blueprint, and changed the class to Actor and back again…and it now works. I’ve seen this before - doesn’t happen often but it does.
I’d recommend VisibleAnywhere for debugging purposes in the code too. It’ll show the component. Hopefully this now works if you do the following.

Steps:

  • Open the Blueprint
  • Click Class Settings on the toolbar
  • Change Parent Class to Actor (or character, doesn’t matter)
  • Change back to VRCharacter

When I did it, before Is Null was output to the log. Now it isn’t.

I really hope this gets you going again.

1 Like

Hello beegeedee, omg it worked!!! :smiley: as you said, changing the class on the BP first to actor then to the vrcharacter made it not null and it showed on the UE interface. Thank you so much my friend!!! I will continue with the course :smiley:

best regards and again thank you!!

1 Like