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

Components Framework Error #3

Open
pcelaya opened this issue Dec 11, 2024 · 1 comment
Open

Components Framework Error #3

pcelaya opened this issue Dec 11, 2024 · 1 comment

Comments

@pcelaya
Copy link
Contributor

pcelaya commented Dec 11, 2024

Hello @pepcots,

I was fixing the Component framework of your Engine and I trembled with a strange error. All the commented code is in the COMPONENTS branch of our engine as I don't want to merge it yet until it works perfectly fine.
The thing is that Components are created in the ModelLoader::loadfromFile() method that returns a GameObject with its necessary components but once I try to add this GameObject as a child of scene->root (using emplaceChild) I find that the Components of the added GameObject have lost their owner pointer (that points to the GameObject created with them). The pointer is not NULL but is instead an strange name that I suspect is binary or something similar.
The Error happens when I call the method owner()->GetComponent() and does not find the Component because the owner() returns something strange. The catch here is that the owner()->GetComponent() that ends the code is one in the Mesh::drawModel() function but (strangely) is not the first I call.
I think that the problem lies in that in some point the code is not correctly moving the pointers but I am unable to find where or why.

Thank you,
Pol Celaya

@pepcots
Copy link
Member

pepcots commented Dec 11, 2024

Hi @pcelaya !
A part of moving the components you have to reasign the owner of the components.
If you can not do that, due to the owner being a reference, try with a pointer instead.

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

No branches or pull requests

2 participants