ActorComponent gets none in blueprint
I have written an UInventoryComponent class which inherits from UActorComponent. I register it to my character in its constructor this way:
however, when I restart the engine or change my characters c++ class, this Inventory component becomes None in blueprint. It throws error when I try to use it.
The solution I found was to remove the CreateDefaultSubObject line, then compile, then re-add the line again, and compile, and everything works fine. This, as you notice, is a boring process and I believe this is not the expected behavior of the engine. If I add the component from blueprint (not from c++ constructor) I never have any problem.
What may be the solution? Thanks
I had kind of same issue about overlap/hit events. I think, this is about hot reload. I couldn't find any solution, however, the user "NoCodeBugsFree" suggested that re-parenting BP class to another class and then going back to the original class solves the issue sometimes. So, it looks like there is no solution. When it happens, closing and reopening editor should solve the issue.
Here is my similar issue: https://answers.unrealengine.com/questions/848293/view.html
answered Dec 29 '18 at 10:34 PM
Did you created blueprint of your character class, or c++ version?
I noticed an issue in blueprints, inherited from custom c++ classes, that when you add/change something to its constructor, you must recreate blueprint asset. It seems that blueprint is not updated with new changes So, I fixed it with not creating blueprints from that classes at all, or creating them only when I sure that it finished.
answered Dec 30 '18 at 06:57 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here