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

add a method for copying components #5654

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

MilonPL
Copy link
Contributor

@MilonPL MilonPL commented Feb 4, 2025

title, the result of me being sleep deprived

adds EntityManager methods to either copy a component from one entity to another or copy multiple components from params

the code itself is pretty simple, the EntitySystem proxy methods are CopyComp and CopyComps

thanks to Sloth, FairlySloggersPanda, Kickguy and everyone else who helped make this code

@keronshb
Copy link
Contributor

keronshb commented Feb 7, 2025

Looks good to me but would want another engine maintainer to take a look.

if (!MetaQuery.Resolve(target, ref metadataTarget, false))
throw new ArgumentException($"Entity {target} is not valid.", nameof(target));

if (!HasComponent<T>(source))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utilizing something like CopyComps(source, ent, null, typeof(VocalComponent), typeof(SpeechComponent)); causes a Unknown component: IComponent error

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants