FlaxEngine / FlaxEngine/FlaxEngine

Add `Clone/CloneDeep` support for `API_AUTO_SERIALIZATION()`

Open
#1,116 2 comments 0 reactions 0 assignees View on GitHub
suggestion tools
Dominant language
C++
Stars
7k
Forks
713
Avg merge
7d 11h
Merged PRs (30d)
19

Description

**Issue description:**
Currently, if you wanted to copy an object, you would either use an already presented in the engine serialization mechanism, or would write your own inheritance based `Clone` methods. I am aware that the preferred method of working in situations like this is to have a prefab, but there are legitimate reasons to want to clone an object. Considering that we are already building on fly entire serialization/deserialization, it should not be a problem to simply add a cloning operation by writing to the target obj of the same type instead of the serialize context. Calls to said generation-based could be implemented with the same inheritance-based system in order to support deep copying. Or maybe separate it into two methods - `CloneDeep` would call base-class'es `CloneDeep`'s as well, while `Clone` would only do one level of cloning.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.