Announcement

Collapse
No announcement yet.

It is possible to expose component variables to blueprint details?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    It is possible to expose component variables to blueprint details?

    Hi all!

    I have an actor component created in C++, and this component has two float variables named rotationSpeed and moveSpeed.
    After i add this component to an actor, i would like to change these variables in the actor details panel, but it do not appear here.

    And, if i select the component in the actor details, i get this message: "Blueprinted components must be edited in the Blueprint".


    This is the class declaration:

    Code:
    UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
    class UMovementHelper : public UActorComponent

    And these are the variables:

    Code:
    // The speed at which the actor will rotate
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Movement Helper")
    float moveSpeed;
    
    // The speed at which the actor will move
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Movement Helper")
    float rotateSpeed;

    Thanks in advance for any help .

    See ya!

    #2
    Hi Ariath,

    Are you able to see these variables of your component if you attach this component to a blueprint of an actor? Try making an actor blueprint, opening it in the blueprint editor, add your custom component to the blueprint, and check to see if the variables will show up in the details or class default windows there, inside the blueprint editor.

    Normally if a variable or component is added in a blueprint, it is considered 'Inherited' in the default editor. This makes it only editable in the blueprint. I believe this is why you're seeing that message that why the variables aren't showing up.

    Comment


      #3
      Thanks for the quick answer .

      Yes, the variables are accessible only from the blueprint editor.
      So, if i understand correctly, what you says is that only the components that are added to an C++ actor (not a blueprint one) are accessible from the actor details panel, right?

      See ya!

      Comment


        #4
        That is correct, and those will not be accessible in the blueprint editor if they are added outside of the blueprint.

        Comment


          #5
          That is not true. When adding a custom component to your character and you want to expose the components variables in the editor. Simply create a uproperty in your character for the custom component. Set the UPROPERTY(EditDefaultsOnly, Category = Speeds). Make sure that your custom component also is property exposing the variables you want to edit. Then in your character initialization add this:

          CustomComponent = PCIP.CreateDefaultSubobject<UCustomComponent>( this, TEXT("Speeds"));

          Then in your character BP on the left you'll see all the component of your character. Yours will be there and be able to be edited.

          Comment

          Working...
          X