What is this bug?

At every step, I am encountering a stupid bug. I would be glad if you can provide some insight. I hope I am stupid and doing something wrong and this is not a bug.

Here is my setup:

  • I have a class AInteractableBase, which has a camera object ACameraActor* TempCameraActor.
  • I assign this is marked as EditAnywhere, and I assign a camera object that exist in my level.
  • When I interact with the object, I use blend camera, I do a nullptr check before of course.
  • I have 2 AInteractableBase objects. One of them is a blueprint based on AInteractableBase, BP_Interactable1. This has some additional meshes and visual stuff. Other one is created directly dragging AInteractableBase from c++ classes folder in context browser. Then I assigned a mesh to this.
  • I assign same camera actor to TempCameraActor for both objects.

Here is what happens:

  • For raw c++ object, everything works flawlessly.
  • For blueprint based one, nullptr check fails. TempCameraActor is detected as nullptr for some reason. So my code doesn’t work for blueprint one only !!

Here is another error I had 10 minutes before this:

  • I was creating a camera component UCameraComponent* InteractionCamera.
  • Then I do CreateDefaultSubobject and SetupAttachment, usual stuff.
  • Suddenly my object has 2 cameras !!

WTF is going on? Why is this engine so buggy, what am I doing wrong, why does my blueprint object fails nullptr check?

Edit: I forgot to mention that for blueprint object, whole thing worked once and never worked again.

I am about 8 years on this train.

You must be crazy enough to continue fight. Unreal Engine too large work ideal.

2 Likes

The only way I can really inspect this is by seeing the code. You can post some blueprint nodes to blueprintue (or screenshot), and past code in codeblocks, that makes it far easier to debug for us.

Once the code is posted here it’s easiest to debug things one by one, so don’t yet make changes.

From your description i puzzle together that you are creating a component on an actor in c++, stored under a UPROPERTY on that actor, with specifier “EditAnywhere”. That is going to bug. Use “VisibleAnywhere” or expect hell :slight_smile: . I had to recreate such blueprints in the past (bug corruption), and there being a stack of oddities I hardly remember it by now. Still. This sticked:

protected:

	UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
		UPhysicsHandleComponent* PhysicsHandleComponent = nullptr;
1 Like