AVolume derived classes that worked in 4.22 are behaving inconsistently between builds and even loads in 4.23.
Make plugin
Use the editor wizard to create an AVolume derived C++ class named “MyVolume”.
Build, reload and drag MyVolume into world. Note that volume bounding box appears and brush is set.
Add some properties to the class in C++. Rebuild and reload.
MyVolume no longer creates bounding box and brush shape is unset. Setting brush shape makes no difference.
Quit editor, delete all binaries folders, saved, intermedia and project. Generate project files. Remove all modifications to MyVolume. Clean build project. Load editor.
Drag new MyVolume 2 into world. Volume bounding box does not appear.
This isn’t a perfect set of steps to recreate it - it’s very inconsistent but I am definitely getting multiple failures as described above.
Update: I moved my code back to 4.22 and the problem manifested itself there too. There must be something wrong with my code. Here is the header: https://pastebin.com/VeFgHuEj
I cannot for the life of me work out what the issue is, nor why the above behaviour still manifests after the class has been reverted.
It looks like what’s happening is that the correct Actor Factory isn’t being set and passed to the Item Details (wherever that gets set: I delved in and ended up template code that I couldn’t reverse engineer to find where it was called from). So the engine tries to work out what factory to use. The way it does this is by looping through the available factories and finding the first one that claims to be able to construct your object.
(This is done in the function: AActor* FActorFactoryAssetProxy::AddActorForAsset( UObject* AssetObj, bool SelectActor, EObjectFlags ObjectFlags, UActorFactory* FactoryToUse /*= NULL*/, const FName Name ) in file \ue4\Engine\Source\Editor\UnrealEd\Private\AssetSelection.cpp
If it gets another factory first with higher priority, it uses that one instead of the correct factory. In my case I had a blueprint subclass, so it was using the actor blueprint factory instead of the actor box volume factory.
Sorry this isn’t necessarily particularly helpful, but it may a) offer some insight for how you can work around it, and b) offer the devs at Epic some insight as to how to fix this.
Got around to trying it finally. I can confirm that it’s running the constructor but that’s it, it never runs CanCreateActorFrom(), which is all that the BoxVolume ActorFactory runs.
My theory is that some other factory is intercepting it. I’m just not good enough at debugging yet to figure it out. It must be specific to AVolume derived user classes because otherwise it would have been picked up quickly. Could UEditorEngine::CreateVolumeFactoriesForNewClasses() be part of the problem?
Alternately, line 540 of PlacementModeModule.cpp has this:
I know this is an old question but I ran into this exact issue in 4.27 and the problem was I had my plugin LoadingPhase set to PostEngineInit in the uplugin file. This meant my Volume wasn’t getting associated with the correct factories during the InitEditor call in EditorEngine.cpp. If you search for ‘NewFactory->NewActorClass = VolumeClass’ you should see where this happens. Changing the LoadingPhase back to Default in the uplugin file fixed it for me.
My plugin LoadingPhase is PostEngineInit.
In 4.24 everythins is ok
But in 4.26 volume can not apprear in level editor viewport.
The reason in above replies, and my plugin LoadingPhase can not set to Default.
So how to fix this?
Create a actor factory, AssetData.AssetClass already set to actor, but can use class path do this.