Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added note about AttributeSet being Transient. #70

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ The best documentation will always be the plugin source code.
> 9.2 [`ScriptStructCache` errors](#troubleshooting-scriptstructcache)
> 9.3 [Animation Montages are not replicating to clients](#troubleshooting-replicatinganimmontages)
> 9.4 [Duplicating Blueprint Actors is setting AttributeSets to nullptr](#troubleshooting-duplicatingblueprintactors)
>       9.4.1 [Not creating `AttributeSet` in the constructor](#troubleshooting-duplicatingblueprintactors-no-constructor)
>       9.4.2 [Making `AttributeSet` `Transient`](#troubleshooting-duplicatingblueprintactors-transient)
> 9.5 [unresolved external symbol UEPushModelPrivate::MarkPropertyDirty(int,int)](#troubleshooting-unresolvedexternalsymbolmarkpropertydirty)
> 9.6 [Enum names are now represented by path name](#troubleshooting-enumnamesarenowpathnames)
> 1. [Common GAS Acronyms](#acronyms)
Expand Down Expand Up @@ -3126,7 +3128,11 @@ Make sure that you're using the `PlayMontageAndWait` Blueprint node instead of `

<a name="troubleshooting-duplicatingblueprintactors"></a>
### 9.4 Duplicating Blueprint Actors is setting AttributeSets to nullptr
There is a [bug in Unreal Engine](https://issues.unrealengine.com/issue/UE-81109) that will set `AttributeSet` pointers on your classes to nullptr for Blueprint Actor classes that are duplicated from existing Blueprint Actor classes. There are a few workarounds for this. I've had success not creating bespoke `AttributeSet` pointers on my classes (no pointer in the .h, not calling `CreateDefaultSubobject` in the constructor) and instead just directly adding `AttributeSets` to the `ASC` in `PostInitializeComponents()` (not shown in the Sample Project). The replicated `AttributeSets` will still live in the `ASC's` `SpawnedAttributes` array. It would look something like this:
There is a [bug in Unreal Engine](https://issues.unrealengine.com/issue/UE-81109) that will set `AttributeSet` pointers on your classes to nullptr for Blueprint Actor classes that are duplicated from existing Blueprint Actor classes. There are a few workarounds for this:

<a name="troubleshooting-duplicatingblueprintactors-no-constructor"></a>
#### 9.4.1 Not creating `AttributeSet` in the constructor
I've had success not creating bespoke `AttributeSet` pointers on my classes (no pointer in the .h, not calling `CreateDefaultSubobject` in the constructor) and instead just directly adding `AttributeSets` to the `ASC` in `PostInitializeComponents()` (not shown in the Sample Project). The replicated `AttributeSets` will still live in the `ASC's` `SpawnedAttributes` array. It would look something like this:

```c++
void AGDPlayerState::PostInitializeComponents()
Expand Down Expand Up @@ -3177,6 +3183,18 @@ if (AbilitySystemComponent)

As a reminder, the `ASC` only ever expects at most one `AttributeSet` object per `AttributeSet` class.

<a name="troubleshooting-duplicatingblueprintactors-transient"></a>
#### 9.4.2 Making `AttributeSet` `Transient`
The other workaround for this issue, which seems to work, is to set the `AttributeSet` object to be `Transient`:

```c++
UPROPERTY(Transient)
class UGDAttributeSetBase* AttributeSetBase;
```

Thanks to that, even when the `AttributeSet` is created in the constructor it won't be serialized and copied when duplicating Blueprint Actor.


**[⬆ Back to Top](#table-of-contents)**

<a name="troubleshooting-unresolvedexternalsymbolmarkpropertydirty"></a>
Expand Down