Skip to content
Valentin Plyasinov edited this page May 11, 2025 · 20 revisions

Welcome to the Blueprint Component Reference Plugin wiki!

Overview

Blueprint Component Reference provides a universal way of referencing actor components during design time with component picker UI and rich customization.

Variable Declaration

Blueprint Component Reference can be used as a single, array, set or map variable in following scenarios:

  • Variable directly located in Actor Class or Blueprint.
UCLASS()
class AMyActor : public AActor
{
    GENERATED_BODY()
public:
    UPROPERTY(EditAnywhere, BlueprintReadOnly)
    FBlueprintComponentReference SingleComponentReference;
};
  • Variable indirectly located in Actor Class or Blueprint.
UCLASS()
class UDemoComponent : public USceneComponent
{
     GENERATED_BODY()
public:
    UPROPERTY(EditAnywhere, BlueprintReadOnly)
    FBlueprintComponentReference AlsoAValidProperty;
};

USTRUCT()
struct FRotatingPointsDesc
{
    UPROPERTY(EditAnywhere, BlueprintReadOnly, meta=(AllowedClasses="/Script/Demo.AttachPointComponent"))
    FBlueprintComponentReference AttachPoint;
    UPROPERTY(EditAnywhere, BlueprintReadOnly)
    float RotationSpeed = 0.3f;
};

UCLASS()
class AMyActor : public AActor
{
     GENERATED_BODY()
public:
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
    TObjectPtr<UDemoComponent> DemoComponent;

    UPROPERTY(EditAnywhere, BlueprintReadOnly)
    TArray<FRotatingPointsDesc> RotatingPoints;
};
  • Variable outside of Actor Blueprint or Class with explicit ActorClass parameter
UCLASS()
class UDecorationType : public UDataAsset
{
     GENERATED_BODY()
public:
    UPROPERTY(EditAnywhere, BlueprintReadOnly, meta=(ActorClass="/Script/Demo.PlayerCharacter", AllowedClasses="/Script/Demo.AttachPointComponent"))
    FBlueprintComponentReference Target;
};

Component picker does support variety of filtering parameters:

  • Filtering by component class/interface with AllowedClasses and DisallowedClasses parameters
  • Filtering by component creation method with ShowNative, ShowBlueprint, ShowInstanced, ShowHidden, ShowEditor parameters

Variable Query

To acquire pointer to component referenced by Blueprint Component Reference an Actor search context is needed.

In Code it is done with GetComponent function call, in Blueprints with Get Referenced Component or Find Referenced Component nodes.

void AMyActor::SomeFunction()
{
    if (UMyComponent* Component = Reference.GetComponent<UMyComponent>(/* Search Context */ this))
    {
        Component->PerformAction();
    }
}

Installation

There are several ways to install the plugin: from GitHub and from Marketplace (coming soon).

From Github

  1. Download source code archive from main or Releases page
  2. Unpack the contents into "YourProjectFolder/Plugins/BlueprintComponentReferencePlugin" (create if missing)
  3. Activate plugin in editor Plugins menu

From Marketplace

Blueprint API

Plugin provides following Blueprint APIs:

  • Component Search is performed with Get Referenced Component, Find Referenced Component, Get Referenced Components nodes.
  • Component Reference state can be checked with Is Valid Component Reference, Is Null Component Reference nodes.
  • Equality and ToString conversion nodes.

Native API

All plugin primary functions located in BlueprintComponentReference module BlueprintComponentReference.h file.

To add plugin features in project following steps are necessary:

  • Enable Blueprint Component Reference Plugin in Plugin Settings
  • Add BlueprintComponentReference module dependency in appropriate Build.cs file
  • Use BlueprintComponentReference.h header file for the FBlueprintComponentReference type

Component selection rules and other traits can be specified with metadata specifiers. Latest list of specifiers can be found here

More examples can be found in BlueprintComponentReferenceTests module.

Advanced Usage

Similar to engine component reference implementation FBlueprintComponentReference does not provide internal cache and each call of GetComponent will do resolve/search.

When repeated component search is an issue there are at least two ways to avoid repeated component search:

  • caching search result separately
  • using TCachedComponentReference helper that wraps FBlueprintComponentReference with a weak object pointer to found component.