Make auto comp states infer when data should be cloned (#4461)

This commit is contained in:
DrSmugleaf
2023-09-29 22:14:10 -07:00
committed by GitHub
parent 3b6adeb5ff
commit 4818c3aab4
4 changed files with 58 additions and 45 deletions

View File

@@ -32,20 +32,6 @@ public sealed class AutoGenerateComponentStateAttribute : Attribute
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public sealed class AutoNetworkedFieldAttribute : Attribute
{
/// <summary>
/// Determines whether the data should be wrapped in a new() when setting in get/handlestate
/// e.g. for cloning collections like dictionaries or hashsets which is sometimes necessary.
/// </summary>
/// <remarks>
/// This should only be true if the type actually has a constructor that takes in itself.
/// </remarks>
[UsedImplicitly]
public bool CloneData;
public AutoNetworkedFieldAttribute(bool cloneData=false)
{
CloneData = cloneData;
}
}
/// <summary>