Grab/Release Functions Not Showing in Blueprints

After running into issues with Components disappearing, I turned off Live Coding as was recommended in other posts. I ran into an issue with the Mover and Grabber Classes no longer showing up when trying to add, and after much troubleshooting, I ended up deleting and recreating those classes, following the tutorial steps.

Now when I try to use the Grab and Release functions in the Grabber Class, they no longer show up in blueprints.

I’ve tried Building/Rebuilding in VSCode, refreshing the Visual Studio Code Project, closing out of both Unreal Editor and VSCode, rebooting my machine… nothing seems to work.

Grabber.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Components/SceneComponent.h"
#include "Grabber.generated.h"


UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class CRYPTRAIDER_API UGrabber : public USceneComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UGrabber();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

	UFUNCTION(BlueprintCallable)
	void Grab();

	UFUNCTION(BlueprintCallable)
	void Release();

private:
	UPROPERTY(EditAnywhere)
	float MaxGrabDistance = 400;

	UPROPERTY(EditAnywhere)
	float GrabRadius = 100;
		
};

Grabber.cpp

// Fill out your copyright notice in the Description page of Project Settings.


#include "Grabber.h"
#include "Engine/World.h"
#include "DrawDebugHelpers.h"

// Sets default values for this component's properties
UGrabber::UGrabber()
{
	// Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
	// off to improve performance if you don't need them.
	PrimaryComponentTick.bCanEverTick = true;

	// ...
}


// Called when the game starts
void UGrabber::BeginPlay()
{
	Super::BeginPlay();

	// ...
	
}


// Called every frame
void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
	
}

void UGrabber::Grab()
{
	FVector Start = GetComponentLocation();
	FVector End = Start + GetForwardVector() * MaxGrabDistance;
	DrawDebugLine(GetWorld(), Start, End, FColor::Red);

	FCollisionShape Sphere = FCollisionShape::MakeSphere(GrabRadius);
	FHitResult HitResult;
	bool HasHit = GetWorld()->SweepSingleByChannel(
		HitResult, 
		Start, 
		End, 
		FQuat::Identity, 
		ECC_GameTraceChannel2, 
		Sphere
	);

	if (HasHit)
	{
		// Establish a pointer called HitActor
		AActor* HitActor = HitResult.GetActor();
		// Use the pointer with the GetActorNameOrLabel Method to display the actor name
		UE_LOG(LogTemp, Display, TEXT("We have hit something! Actor is: %s"), *HitActor->GetActorNameOrLabel());

	}
	else
	{
		UE_LOG(LogTemp, Display, TEXT("No Actor Hit."));
	}
}

void UGrabber::Release()
{
	
	UE_LOG(LogTemp, Display, TEXT("Released."));
}

Thank you for any help you can provide!

  1. Does it compile successfully
  2. Is the grabber in the blueprint a UGrabber?
  1. It does compile successfully in Unreal, and the Build in VSCode was successful as well.
  2. I’m not sure I understand this question… I followed the steps to add the Grabber class to the Camera component like in the video, and the functions in the cpp file are all UGrabber… Where can I check in the blueprint to see if I am using the UGrabber?
  1. Hover over the component, it should say the type (class prefixes are removed).
    image

When I hover over it, it looks the same as the screenshot you provided.

Could you try deleting the Binaries and Intermediate folders and then attempting to re-open the project?

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

Privacy & Terms