All the UInterface types explained in Cpp (Condensed Version) - Unreal Interfaces - UE C++ Tutorial
Автор: enigma tutorials
Загружено: 2024-09-14
Просмотров: 453
This is a condensed version of the full video here: • All the UInterface types explained in Cpp ...
The Unreal engine provides interfaces as a primary feature of the engine.
When considering C++ and blueprint, there's 3 different ways interfaces are used.
We have Blueprintable, NotBlueprintable, and Blueprint interfaces.
This video goes through the different permutations, the nuances between them, and provides mental model to quickly reason about the differences.
TSubclassOf can be constrained using the MustImplement keyword.
UClass has the ImplementsInterface function for runtime checks.
UObjects have Implements method to check if it implements an interface.
Casting to IType only works reliably for code classes implementing interfaces
The Implements method is the most reliable way to check for an interface, as it works in all contexts I have tested.
Additional notes:
While not covered in the video, you can still use TScriptInterface with NotBlueprintable interfaces, in the way that I shown for BlueprintableInterfaces.
For clarity, ImplementsInterface is a method of UClass, not TSubclassOf. See UClass::ImplementsInterface
Common Errors around Blueprintable and NotBlueprintable. My mental model helps explain these.
Interfaces that are not implementable in blueprints cannot have blueprint event members.
Blueprint implementable interfaces cannot container blueprintCallable functions that are not BlueprintImplementableEvents. Add NotBlueprintable to the interface if you wish to keep this function.
Recorded in 5.3
0:00 Begin Slide Show
0:01 High Level Interface Types
0:26 UType vs IType
0:53 Why use Interfaces
1:26 Blueprintable vs NotBlueprintable
2:29 NotBlueprintable and Blueprintable and Blueprint interface nuances
2:39 Blueprintable Code Inheritance - has valid IType pointers
2:56 Blueprintable Blueprint Inheritance - does not have valid IType pointers
3:18 A useful mental model
3:35 Blueprint defined interfaces
3:39 Interface Inheritance Mental Model Review
4:09 The usefulness of the Mental Model approximation
4:24 Implements vs Cast
5:52 Passing parameters to Blueprintable interface events requires object pointer
6:48 Using TScriptInterface
8:30 Blueprintable NotBlueprintable - I-interface isn't valid for blueprints implementing interface
9:00 Mental Model Explains: BlueprintNativeEvent doesn't allow bp to call super, and default return values
10:30 TSubclassOf constraining to interfaces -- MustImplement
11:15 Checking TSubclassOf at runtime using the ImplementsInterface function
11:54 Blueprint Interface Calls - Direct vs Messages
12:31 Summary
13:07 Outro
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: