Duplicate editable/concrete classes

Hey, since we can duplicate actors and Verse devices in UEFN and this will lead to two separate instances with the same properties, I wonder if we could have a similar feature in Verse.

Imagine I have this code:

ability_class:=class:
    @editable Name: string
ability1_definition:=class<concrete>(ability_class):
    Name<override>: string = "1"
    @editable SomeField1: int = 0
# ...
ability1000_definition:=class<concrete>(ability_class):
    Name<override>: string = "100"
    @editable SomeField1000: []creative_device = array{}
    @editable Rotation: rotation = rotation{}

So let’s say that I have a “ability_manager_device”, that I use to set the editable fields and want to create copies of all 1000 different ability instances (perhaps each player needs a separate instances of an ability class), then i would need to instantiate 1000 instances and copy every single value over to the new instance, on top of creating a deep copy (since i dont want them to reference the same objects, but separate copies etc).

However UEFN basically does this when duplicating a creative_object in the editor, so it would be nice if we could get some Verse API for that (allowing us to deep copy a concrete class by duplicating all it’s editable fields into the new copy).

Hey I like the idea, but while it is not being implemented, I was wondering…

Maybe we can already do this by putting your whole @editable config inside a struct, you should be able to make a new class that has the same config struct

Something like

ability_config := struct<concrete>:
    @editable
    FieldA : int = 0

    @editable
    FieldB : creative_prop = creative_prop{}
ability1000_definition := class<concrete>(ability_class):
    @editable
    Config : ability_config = ability_config{}
AbilityToCopy : ability1_definition = GetAnyAbilityOne()
NewAbility := ability1000_definition{Config := AbilityToCopy.Config}

Hope it helps :person_shrugging:

Wouldn’t NewAbility.Config still be referencing the same instance as AbilityToCopy.Config?
The thing is, that i can’t change the editable attributes in NewAbility.Config without changing the AbilityToCopy.Config too. Also, all ability_definitions share some fields, but not all.

I don’t think structs are passed by reference, since they’re immutable, so I’d say that it does a copy, but either way it should work the same way

And yeah this would be just for the shareable part of the config obviously :person_shrugging: