i looked at SceneComponent.h and noticed that AttachTo is a depreciated function, they recommend using AttachToComponent instead, so this could be a possible reason why it works in-game but not in editor.
if that doesn’t solve the problem, then post here and we can look further
I saw you had multiple questions about this, did they solve the problem in those other questions?
You have to create a blueprint from your C++ class and drag that into the editor.
If for some reason you don’t want to make a blueprint, I googled “ue4 construction script c++” and found a bunch of threads about your issue and some workarounds.
It might just be better to expose your functions to blueprint and use the blueprint construction script, but it’s up to you.