diff --git a/ursina/duplicate.py b/ursina/duplicate.py index 9d4a5eb7..7f0116c4 100644 --- a/ursina/duplicate.py +++ b/ursina/duplicate.py @@ -16,18 +16,21 @@ def duplicate(entity, copy_children=True, *args, **kwargs): # use a for loop ins for name in entity.attributes: if name == 'model': continue - elif name == 'collider' and entity.collider and entity.collider.name: + if name == 'collider' and entity.collider and entity.collider.name: # TODO: currently only copies colliders set with strings, not custom colliders. e.collider = entity.collider.name - - elif name == 'scripts': + continue + if name == 'scripts': for script in entity.scripts: e.add_script(copy(script)) + continue else: if hasattr(entity, name): setattr(e, name, getattr(entity, name)) + e.shader_input = entity.shader_input + for c in entity.children: clone = duplicate(c, copy_children=False) clone.world_parent = e @@ -72,7 +75,7 @@ def duplicate(entity, copy_children=True, *args, **kwargs): # use a for loop ins # e2 = duplicate(e) # e2.y += 1.5 - e = Button(parent=scene, scale=1, text='yolo') + e = Button(parent=scene, scale=1, text='yolo', texture='shore', texture_scale=Vec2(2), color=color.gray) # e.c = Entity(parent=e, model='cube', scale=.5, y=.5, color=color.azure) e2 = duplicate(e, x=1.25) # print(e.text_entity.z, e2.text_entity.z)