Skip to content

Fix missing sub-components when retrieved from default components #127

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

Merged
merged 11 commits into from
Mar 6, 2022

Conversation

jacopomaroli
Copy link
Contributor

From https://answers.unrealengine.com/questions/558236/how-to-get-a-component-from-a-classdefaultobject.html

When you GetDefaultObject(), you get only the root component and you're missing all the subcomponents.

In our case this causes an issue when placing a building: when attempting to set the acceptable destination range in the blackboard, you'll always get 0 as that's what you get when you attempt to GetShapeCollisionSize of the building UShapeComponent (that you'll fail to get)

This code will first attempt to work as usual, but if it fails, it will try to get the subcomponents from the blueprint definition.

P.S. Commit history is pretty pointless. Happy to squash and merge

@jacopomaroli
Copy link
Contributor Author

After almost one year I find out you already had an implementation which does what I described so I just reused that.
It works like a charm and it reaches the construction spot flawlessy.

In the demo you just have to tweak a bit the radius in the Behavior Tree (IIRC is fixed to 50)

@npruehs
Copy link
Owner

npruehs commented Mar 6, 2022

Thanks for the PR! :)

@npruehs npruehs merged commit b050e31 into npruehs:develop Mar 6, 2022
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.

2 participants