|
1 | | -*Text* |
| 1 | + |
| 2 | + |
2 | 3 |
|
3 | | - |
| 4 | +## List of nodes: |
| 5 | + |
| 6 | +- [`CowCreateWidgetAsync` - Ultimate Create Widget Async](#CowCreateWidgetAsync) |
| 7 | + |
| 8 | +### CowCreateWidgetAsync |
| 9 | + |
| 10 | +Improved Version of Epic's `CreateWidget` and `CreateWidgetAsync` (from `CommonGame`) |
| 11 | + |
| 12 | +This version combines the best of both worlds with general quality-of-life improvements: |
| 13 | + |
| 14 | +## Key Features |
| 15 | + |
| 16 | +- **No Hard References**: Does not introduce a hard reference to the selected widget class in packaged game (similar to `CreateWidgetAsync`). |
| 17 | +- **ExposedOnSpawn Parameters**: Displays any `ExposedOnSpawn` parameters (similar to `CreateWidget`). |
| 18 | +- **Automatic Handling of `ExposedOnSpawn` Variables**: Automatically adds new `ExposedOnSpawn` variables (which `CreateWidget` does not handle). |
| 19 | +- **Widget Class Pin Enhancements**: |
| 20 | + - Supports linked properties and propagates their class. |
| 21 | + - Example: |
| 22 | + |
| 23 | + Suppose you created a soft class property `MyClass` of type `WBP_BaseWidget` with an exposed member `Text` (so only `WBP_BaseWidget` and derived classes can be selected). |
| 24 | + |
| 25 | + If you connect `MyClass` property to the node, it will properly: |
| 26 | + |
| 27 | + 1. Display any exposed members (`Text` will be shown). |
| 28 | + 2. Set the return type of the node to `WBP_BaseWidget`. |
| 29 | + (Because the pin type already introduces a hard reference (`SoftClass` property to a type `X` is a hard reference to `X`) |
| 30 | +- **Optimal Return Value**: The return value is always the best possible option that avoids a hard reference. |
| 31 | +It will be either the first native class or the widget class if linked to a pin that introduced a hard reference. |
| 32 | +- **Improved Auto-Wiring**: Proper auto-wiring for `ReturnType` to avoid the common mistake of using the `Then` pin instead of `OnWidgetCompleted`. |
| 33 | + |
| 34 | +- **User-Friendly Notes**: Generates informative notes when actions might cause errors. |
| 35 | + - Examples: |
| 36 | + - Introduction of a hard reference. |
| 37 | + - Keeping default values of the base class when a pin of the base class is hooked, which may differ at runtime. |
| 38 | +- **Fix for `FKismetCompilerUtilities::GenerateAssignmentNodes`**: |
| 39 | + - Prevents `DynamicCast` from creating a hard reference through native properties with `BlueprintSetter`. |
| 40 | + - See `FCowCompilerUtilities::GenerateAssignmentNodes` for implementation details. |
| 41 | + |
| 42 | +## Known Limitations |
| 43 | + |
| 44 | +1. Works only with **EventGraph/Macro** (due to being async). |
| 45 | +2. No support for **conflicting names** (e.g., an `ExposedVar` named `"SoftWidgetClass"` will cause an error during node compilation). |
| 46 | +3. **One-frame delay** even if the soft reference is already loaded due to `LoadAsset` (TODO). |
| 47 | +4. **Editor Limitation**: In the editor, the node holds a **hard reference** to the `WidgetClass`. |
| 48 | +This is required for pin generation and proper reloading when `WidgetClass` changes. |
0 commit comments