Have problem recompiling a UE4.27 plugin to UE5

Hello everyone,I try to recompile a plugin from ue4.27 to ue5.03.

But the widget show part seems to have problem.

Compile errors occurs with [ModeTools] like this.

FSpriteEditorViewportClient::FSpriteEditorViewportClient(TWeakPtr InSpriteEditor, TWeakPtr InSpriteEditorViewportPtr)
: CurrentMode(ESpriteEditorMode::ViewMode)
, SpriteEditorPtr(InSpriteEditor)
, SpriteEditorViewportPtr(InSpriteEditorViewportPtr)
{
check(SpriteEditorPtr.IsValid() && SpriteEditorViewportPtr.IsValid());

    **Widget->SetUsesEditorModeTools(ModeTools);**

    PreviewScene = &OwnedPreviewScene;
**((FAssetEditorModeManager*)ModeTools)->SetPreviewScene(PreviewScene);**

}

And there is the error code:
C2664 “void FWidget::SetUsesEditorModeTools(FEditorModeTools *)”: cannot covert argument 1 from“TSharedPtr<FEditorModeTools,ESPMode::ThreadSafe>”to“FEditorModeTools *”
C2440|cannot convert “TSharedPtr<FEditorModeTools,ESPMode::ThreadSafe>” to “FAssetEditorModeManager *”

I check the declare of [ModeTools]、Widget、they are declared in UE5 codes,so I can’t edit it.

Is there any way to solve this problem?

If you need more information,I am waiting to upload.

no expert here but I’ve had the “pleasure” to try following a programming tutorial made for UE4 but using UE5.

bunch of variables and stuff has changed. you need to check if those unreal variables had been renamed, maybe there are new alternatives or something like that

Thanks for your help!

Just like your reply,I have changed several variables and deleted unused before post this thread.But I can’t find any more information on google or ue5 documentation.

I am sure the main problem is the [ModeTools] variable.

According to documentation,
in UE4.27,ModeTools syntax is " FEditorModeTools * ModeTools"
in UE5.0,the syntax is " TSharedPtr< FEditorModeTools > ModeTools"

This should be the problem,but I don’t know how to fix it.