I can't set variables within the actor component

I’m trying to set a varible within my actor component but when I get it in another blueprint, it has no information to get.
Sorry but my engine is set to german…

1 Like

How do we know that this:

Is the same component as this:

Since you:

get it in another blueprint

How did you communicate it? How does another blueprint know which component to get the rotation from?

I implemented the component in both blueprints. So, I thought that the actor component can store variables with their values and I can get those values in every blueprint the actor component is implemented in.

That’s the issue - you have 2 (or more) component instances.

So, I thought that the actor component can store variables with their values

True.

and I can get those values in every blueprint the actor component is implemented in.

Default values, sure. But if you update one instance of the component, other instances don’t know about it. You should be updating and accessing the same component instance.


It’s a bit like placing empty glasses (components) on the table, fill one with water (update it) and expect other glasses to be full, too. Not sure if an analogy was needed.

2 Likes

The analogy definitely helped. So in the following picture I set the variable within the actor component. So now I should be able to get the rotation from my unit in every blueprint which has th actor component implemented in, shouldn’t I?

I know I could make this code shorter but thats a screenshot from a debugging test. So don’t mind it.

It should work OK if there’s only 1 banner. If you have more than 1, the Get Actor of Class node may not fetch the one you want.

Yes I think there will be only one. What should I do when I have child actors?

You will need to reference the desired actor properly. There surely is logic in the project that dictates which banner actor needs rotating. How do we choose which one?

Yeah I see, child actors will have different names, so that’s not a problem. And when there are copies of one actor in the world, they would all need the same information. You can’t know that because that’s just the logic of my game specifically. But who knows maybe I come back here when I get this problem. For now thank you very much

1 Like

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