# Failed to load c++ class (plugin) after editor restart

**URL:** <https://forums.unrealengine.com/t/failed-to-load-c-class-plugin-after-editor-restart/484156>\
**Category:** Plugins\
**Tags:** failed-to-load, unreal-engine, Scripting, Plugins, question\
**Created:** [May 30, 2021, 7:26pm UTC](https://forums.unrealengine.com/t/failed-to-load-c-class-plugin-after-editor-restart/484156 "2021-05-30T19:26:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khorne1337](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Khorne1337](https://forums.unrealengine.com/u/Khorne1337)\
**Post date:** [May 30, 2021, 7:26pm UTC](https://forums.unrealengine.com/t/failed-to-load-c-class-plugin-after-editor-restart/484156/1 "2021-05-30T19:26:49Z")

</div>

Hey guys,  
I implemented a plugin that contains an abstract c++ parent class (InventorySlotUI) and a BP widget that inherits from it (SimpleInventorySlotUI) in the content folder. Another BP widget (InventoryUI) is using this and the first time I put everything together it compiles fine and it works also during gameplay. However, everytime I restart the project I get these messages:

 ![340251-failed-to-load.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/1/1/911b837ede0c2421f870da8ec82a2dc4977b40c7.png)

If this happens the parent of my SimpleInventorySlotUI BP is NONE instead of my c++ class InventorySlotUI and cannot be opened anymore. If I remove the usage of it in InventoryUI and I restart the project it loads properly again.

When I try to open the BP I get the message even though I see the class in the editor:

_Widget Blueprint could not be loaded because it derives from an invalid class.  
Check to make sure the parent class for this blueprint hasn’t been removed!_

I tried deleting all irrelevant folders and recompiled/rebuilded the project which didnt’ help.

Any ideas whats going on here? Not sure if this is the right section to post it.

---

<div class="post-metadata">

**Author:** ![Khorne1337](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Khorne1337](https://forums.unrealengine.com/u/Khorne1337)\
**Post date:** [June 9, 2021, 4:47pm UTC](https://forums.unrealengine.com/t/failed-to-load-c-class-plugin-after-editor-restart/484156/2 "2021-06-09T16:47:35Z")

</div>

After hours of troubleshooting I found out that I had to set the LoadingPhase of the plugin module to PreDefault instead of Default

```
"Modules": [
	{
		"Name": "Framework",
		"Type": "Runtime",
		"LoadingPhase": "PreDefault"
	}
]
```

---

<div class="post-metadata">

**Author:** ![358200](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@358200](https://forums.unrealengine.com/u/358200)\
**Post date:** [August 7, 2022, 1:06pm UTC](https://forums.unrealengine.com/t/failed-to-load-c-class-plugin-after-editor-restart/484156/3 "2022-08-07T13:06:46Z")

</div>

Thanks a lot. 😆

---

<div class="post-metadata">

**Author:** ![wicky\_photo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@wicky\_photo](https://forums.unrealengine.com/u/wicky_photo)\
**Post date:** [January 11, 2024, 4:01pm UTC](https://forums.unrealengine.com/t/failed-to-load-c-class-plugin-after-editor-restart/484156/4 "2024-01-11T16:01:20Z")

</div>

you are my hero! I spent a lot of time on this issue
