Array of actors that inherit interface?
Hello. I'm trying to add a variable for my blueprint, which is an array that holds all actors that inherit the IPerson interface. The use-case is for a building that wants to keep track of who is inside the building. I would like the array to be generic, in that as long as the object implements IPerson, it can be inside the building. Is there any way to do this?
asked Jul 22 '14 at 12:23 AM in Blueprint Scripting
When you declare the array, you can select a type for it. Try typing the name of your interface. If its pops up chose Object 'you interface name'.
..To be honest, I never tried creating an array of interface type. So this may not work.
If that does nor work, another thing to try is to define a Base bleuprint which implements 'IPerson' called PersonBase. Then extend from this BP to create the different Person classes. Later when it comes time to create the array, select Object'PersonBase_C' as the type.
So the hierarchi will be:
IPerson ----> PersonBase --> PersonA, PersonB....
In Java terms:
PersonBase extends Actor (or any other class) implements IPerson
PersonA extends PersonBase
PersonB extends PersonBase
Follow this question
Once you sign in you will be able to subscribe for any updates here