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

✨ duplicate entity instance functionality #140

Merged
merged 1 commit into from Sep 25, 2023

Conversation

bitbrain
Copy link
Owner

Description

Sometimes we want to duplicate entities, e.g. when having self-multiplying enemies in the world that already have a custom state. This can be achieved as follows via this PR:

var entity = Pandora.get_entity("123")
var entity_instance = entity.instantiate()
var duplicate_instance = entity_instance.duplicate_instance()

Additionally, you can also call duplicate_instance() on non-instances to create new instances (acts as instantiate()).

Note: the new method is called duplicate_instance() and not duplicate() as that method is already reserved for traditional Godot resources. It has some different meaning/docs so I did not want to mix up these concepts!

@bitbrain bitbrain merged commit ac22138 into godot-4.x Sep 25, 2023
3 checks passed
@bitbrain bitbrain deleted the duplicate-functionality branch September 25, 2023 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant