Array of implementations of an Interface as a default blueprint variable

Hello, this is my first post, nice to meet you all, really glad to be here.

Okey, in continuing to my problem, I have a few implementations of my interface and I want to add these implementations as default values to my blueprint.

My interface is called CoreObject, and the blueprint where I want to add this array of implementations of my interface is this one

But then I want to add these implementations to the default value of this blueprint and I am unable to add them, it shows in red

As you can see I am unable to add this “Coin” to the default values of my variable, and Coin does implement the “Core Object” interface.

My question is, how can I accomplish this or what I am doing wrong in the way I am trying now.

I have been the last 2 days looking for why it happens, reading about Unreal engine interfaces, and how to interact with them and I did not find an example to do what I am trying right now.

This is one of the best articles I found about variables:

And the unreal doc:

The reason I want to do this way is to only allow instances/implementations of my CoreObject interface to be added as values to this variable from here and in the future.

After a while, I realised that I can do it, setting my variable type as an Object ( The main base object of unreal) and yes I can add them as default this way, but then when I execute the begin play any of the default values implements the interface.

I hope It’s clear, I tried my best to explain it, really appreciate your help I am a newbie in unreal engine.

Thanks in advance,

Hi @infoloren! Welcome to the Forums!

I have a few questions and a possible solution for you!

First and foremost, your blueprint takes in an array of “Core Object” type assets. If your coin is not a “Core Object” type object it will not accept it. Did you use your core object as a parent blueprint? Can you provide more information on how you intend to use these blueprints and what they are supposed to do?

If you would like to inherit features from a base blueprint, what you would want to do instead is create a “Child Blueprint” so that way your new blueprints should be (in theory) of the “Core Object” type.

You can create a child blueprint by right clicking the blueprint that you want as the parent and selecting “Create Child Blueprint Class” from the pop up menu:

You can also learn more about child blueprints here:

Child Blueprints

I hope the above solution works for you!

1 Like

Hello, thanks for the welcome and for the fast response. I am a bit hurry on solving this as I want this to be the core of my project and it’s a blocking problem, really appreciate your time.

About the solution, my blueprint takes an array of “Core Object interfaces”, when I settle the variable type on my blueprint:

As I want all the blueprints that implement that interface be added to the variable.

I tried to create a child class of my Core Object, and it created a child interface of “CoreObject interface” this way:

Here I do not get a blueprint that has an specific behaviour of the method from my interface.
So I think that here I am almost in the same step.

Going to the next, I can create a parent class for example an actor with no behaviour that implement my interface and then set as an abstract class so this method are re-implemented down in the hierachy, at this point, I can set on my blueprint that in my variable I want “Core Object parent class” instances or class references.

Well I do not want instances, cause this is for a spawn system, I set there the blueprints I want and they spawn, so I think that have all my objects spawn somewhere is not a good practique, so I prefer to not spawn them and treat them as a reference, here we got into the “CoreObject class reference” well, I can add those but then at leat with what I know now, I cannot access to my methods cause it’s a reference, at least I do not see on the editor that I can execute my methods there.

The last solution, a reference to my parent class on the variable would be suitable for me, as I do not have to spawn them and well, it’s not what I preferred what was use the implementations of my interface but fills my needs, allowing me to only add to this variable references to specific blueprints.

About inherit, I do not want to inherit, I just want to add blueprints to this variable, like you do in other programming languages like .NET, NodeJS… When you use dependency injectio.

You can load any reference of a class that implements this interface and then execute the method, that is my goal.

Also, again, many thanks @Quetzalcodename for your help and your time I hope the question can be solved soon, I think this could be a really interesting point for a good practique in Unreal projects.


1 Like


I come here to explain my final solution to my problem. That was introduce an array of specific instances with specific behaviour as variable to another blueprint.

As @Quetzalcodename suggest on the post, using a chind class of a parent class and setting this parent class reference as variable type, in this case array of this class reference type.

And then to create my instances I just need to create child blueprints on this blueprint “SlasherObject”.

And then you are able to select them this way:

That was what I wanted in first instance, not the way I though at first time, but accomplish my goals that are, make some functions mandatory, different on each instance and now as it’s a class not an interface, I can set up some common logic on the parent class.

I share this here, as it’s my final solution after a week of research and discussion in this and some other forums.

I hope it’s useful to someone,