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

Fix: Instantiation of a MonoBehaviour doesn't inject the entire instantiated GameObject #452

Merged

Conversation

alvinsay
Copy link
Contributor

When we pass a component to the Object.Instantiate, the Unity actually instantiates the entire GameObject that the MonoBehaviour belongs to. The returned MonoBehaviour instance actually attaches to a newly spawned GameObject which requires injection (initialization) also.

This patch fixes the issue that T Instantiate(IObjectResolver resolver, T prefab ...) series functions don't inject the entire spawned GameObject if a non-GameObject T is provided.

@vercel
Copy link

vercel bot commented Nov 28, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
vcontainer ✅ Ready (Inspect) Visit Preview Nov 28, 2022 at 4:06AM (UTC)

@alvinsay
Copy link
Contributor Author

@hadashiA Do you have time to give a review?

@alvinsay
Copy link
Contributor Author

@hadashiA
Kindly remind you to check this PR at your earliest convenience. Thank you.

@hadashiA
Copy link
Owner

+1 Makes sense, Thanks!

@hadashiA hadashiA merged commit ae21fbd into hadashiA:master Jan 31, 2023
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

2 participants