Is it possible to have abstract class blueprints? Can’t seem to find much on implementing abstract classes and methods in blueprints. How do I make one (if possible) and how do I got about creating abstract methods in blueprints?
I haven’t found a way to do this directly…
My workaround so far is creating an interface, adding this to the parent and then implementing them in the child where I want a different functionality.
It works just fine though it does feel like a bit of a dirty hack.
The more I think about it the less it seems like abstract blueprints aren’t really intended to be made for the simple fact that you would only make an abstract class to be extended from and not instantiated. Blueprints seem like something you would make only for something that would be instanced in the game, though honestly I’m still new to the Blueprint system myself and would really like to know more about translating my existing OOP skills to Blueprint and UE4 C++.
That would be the prefabs system from cry. Blueprints are capable of working independently and are supposed to work seamlessly with c++.
So abstract functions are kinda necessary especially in an event heavy environment.
In that case, does anyone now how to directly implement them? This is kind of a big deal.
Hello DesertEagle_PWN,
There is not a way currently to have a blueprint that is not in some way, shape, or form instantiated. I hope that this answers your question. You could try Erasio’s workaround, this should give you similar functionality.
Make it a great day
Welp, good to have an official answer, is there any chance that this is something we may see in the future? I really appreciate the simplicity of Blueprint, but abstract classes are something that I need fairly frequently.
Edit for spelling.
This might be dirty, but I used a normal Character-blueprint and derived the other classes from it.
Then, to disable instantiation of the super-class, I use the Event “Begin Play” to Destroy the Actor
(“Event Begin Play” → “Destroy Actor”(target: self) )
Not sure if this is the best way to solve the problem, but it works (for me at least).
Hope it helps.
Hello DesertEagle_PWN,
A feature request has been submitted to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.
Make it a great day
Thank you very much Rudy, glad you’re still keeping up with this. I know for most purposes you would implement abstractable functionality in C++ classes and then extend via Blueprints, but it would be nice to easily be able to prototype functionality with some form of completely abstract blueprint (expecially for extending classes that are not Actors.) Thanks again.
I’ve had trouble with this for a while as well. For anyone that doesn’t know you can do what Max mentioned (i’ve done this with “actor” blueprint) but use “events” instead of functions. apparently child events execution override the parent’s event execution path. This is a bit dirty but you can wrap the execution in a comment and collapse it if you wish. This mimics abstract functions very well in my opinion but i don’t know if events are based on pointers(long jump) or not. could anyone elaborate please?
You can mark blueprint class as abstract by checking Generate Abstarct Class
in Class Settings -> Class Options (Advanceed)
.
Nice to know (hi from 2024)!