Assigning default value to variables in inherited components

Hello,
I have this situation:

  • I have a blueprint B which is inherited from blueprint A
  • In blueprint A I have a component CO (an actor) which is of course inherited from blueprint B
  • I would like to set the default value of a variable V contained in component CO in a different way among blueprint A and blueprint B. For example the variable V of CO (contained in A) has default 1, while the variable V of CO (contained in B) has default 2

How can I do it?

Many thanks,
Marco

Are they declared through C++, if so, if you set them to EditDefaultsOnly in UProperty then ever class that inherits from that class should be able to modify the defaults values.

In other words, 2 Blueprints can have different values.

If its declared in BP, then just making it public by pressing the little eye next to its name should make it exposed for each BP that inherits from that BP so they can set its default value

I have set a variable as public in component CO (which is embedded in blueprint A and then in the inherited one B) but this variable is not accessible in any of the blueprints (A nor B - i.e. there is not any method GET to access it).
Any suggestion?

Very strange, a public variable on a component should be able to be editable by blueprints that uses it.

Are you sure you have it selected?

Can you take some pictures of the blueprint that has this component and of the component itself?

I have found how to do it:

  1. I need to use the function Get Child Actor in blueprint B from component CO
  2. I have to cast the above object to the original actor object CO
  3. As object CO, I can get (set) the public variable (unflagging Context Sensitive)

oh yea you always have to cast to the specific class in order to get access to its variables and such.

Glad it worked itself out!