Trying to build my project on version 4.9p4, but it comes up with an error saying:
“P2UVector is not defined”
After looking into it, it appears the function was moved from “PhysicsPublic.h” to “PhysXPublic.h”, however when I add in an include for the new header it gives me this error:
"2>BuoyantDestructible.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ADestructibleActor::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@ADestructibleActor@@UEAAXAEAUFPropertyChangedEvent@@@Z)
2>OceanPlugin.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ADestructibleActor::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@ADestructibleActor@@UEAAXAEAUFPropertyChangedEvent@@@Z)
2>BuoyantDestructible.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl ADestructibleActor::PostLoad(void)" (?PostLoad@ADestructibleActor@@UEAAXXZ) referenced in function "protected: virtual void __cdecl ABuoyantDestructible::PostLoad(void)" (?PostLoad@ABuoyantDestructible@@MEAAXXZ)"
which contains compilation errors in the *.cpp.obj file, and I can’t access it.
Is there way around this error? Everything works perfectly in 4.8.3, but won’t in 4.9
Is this an issue that only occurs with your project that you converted to 4.9 or does it occur even with fresh code projects? If it is particular to your project, would it be plausible to get a copy of your project for debugging purposes? It is probably something that has changed in the source code between 4.8 and 4.9 but without having context, I wouldn’t know where to begin looking.
The code is actually inside a plugin for my project, which is available on GitHub here if you’d like to look through the code (this is the class with issues, BuoyantDestructible.cpp):
I have not tested it in a new project, however attempting to upgrade the project to 4.9p4 produces the error.
The P2UVector() function was moved from PhysicsPublic.h to PhysXPublic.h, the above error occurs when I try to include the new PhysXPublic.h to eliminate the compiler error for undefined function P2UVector().
Both of these classes are in this folder of UE4:
TK-Master is working on this project with me, he will add some more detailed info shortly
I can confirm that this happens in a clean project.
All we are trying to do is extend the ADestructibleActor class so we can do custom physics on tick (using rama’s physx guide as base reference btw).
But even with a nearly empty class it still seems to throw the PostEditChangeProperty and PostLoad error.
What would be the correct way to extend ADestructibleActor in 4.9?
Any sample code would be awesome
Hello DotCam & TK-Master,
It seems that the issue here isn’t actually the change of the header file but the fact that DestructibleActor is marked as MinimalAPI, which is what is causing these issues. This will prevent the entire class from being used in this case. Is it possible for you to use a DestructibleComponent on a base Actor instead and still have the means to accomplish what you’re working on?
If this weren’t a plugin project I would suggest simply using a version of the engine compiled from source code so you could remove the MinimalAPI tag yourself but that wouldn’t work once the plugin is used by people on a Binary version of the engine.
If there are particular reasons why DestructibleActor is a must-have for this endeavor, please let me know and I’ll put in a feature request for this to be changed.
TK gave your suggestion a try, and was able to come up with a solution using the DestructibleComponent instead. He still has some more testing to do, but everything is working properly so far. If we run into any issues we’ll let you know, but this seems to work well for our needs.
Thanks a lot for your help, much appreciated!
#Yes please, Must Have
I’ve been extending DestructibleActor since the Beta program, and now in 4.9 I can’t anymore
“If there are particular reasons why
DestructibleActor is a must-have for
this endeavor, please let me know and
I’ll put in a feature request for this
to be changed.”
Yes please! I’d love to be able to extend DestructibleActor again, even though it is just a wrapper for a DestructibleComponent.
I will have to shift over to using DestructibleComponent in the meantime.
#How To ReCreate DestructibleActor
Actually its easy to just remake DestructibleActor
Just extend AActor instead and then
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Destruction, meta = (ExposeFunctionCategories = "Destruction,Components|Destructible", AllowPrivateAccess = "true"))
/** Returns DestructibleComponent subobject **/
UDestructibleComponent* GetDestructibleComponent() const;
in your constructor
DestructibleComponent = CreateDefaultSubobject(TEXT("DestructibleComponent0"));
RootComponent = DestructibleComponent;
UDestructibleComponent* AJoyDestruction::GetDestructibleComponent() const
I understand your concern to extend DestructibleActor after you have done so previously but it was never intended to be extended previously. This was something that was considered a fix. It seems as though using a DestructibleComponent on a base Actor works as DestructibleActor itself is suitable at the moment.
If this is to be considered for extension, I’ll need a reason as to why in the form of something that you’re hindered by when using the Component instead of the Actor.
I have this same problem and have been running a subclass of this actor since it I started. Thank you DotCam Rama and all for pointing this out. My concern is that we had no way of knowing Epic’s intention to break this functionality and I’m having a hard time seeing what this fixed.
My suggestion is that if you intend to break extending a class in the future, put information in the comments of the actor or something.