This is the weirdest bug I've found. This has happened to me on multiple occasions with different components and I have no idea what is happening.
The long and short of it is that I have a component which gets initialized in the C++ constructor and is allocated memory. As soon as the constructor completes, that memory is deleted and set to NULL.
I thought that for sure, this component is being garbage collected and I triple checked it. I even stepped through the engine side code, line by line, especially in the garbage collector, and I did not see my component in the collection queue. Something else is happening and my component is getting deleted and set to null, and I can't seem to find where its happening.
I tried deleting all of my intermediate files and DDC. This had zero effect. The result was the same.
However, if I rename my component from "MyComponent" to "MyComponent2", it works perfectly fine.
If I rename MyComponent2 back to MyComponent, it gets deleted again.
I have even set my component to private and created a const "GetMyComponent() const" getter method to make sure that no other class is messing around with the component. This makes no difference.
I suspect that there is something happening internally within the blueprint, where a stale value or symbol is getting stomped. To test this hypothesis, I left the component name unchanged, so that it would 'fail' and get set to null after the class constructor has completed. Then I created a brand new blueprint which inherited from the same base class and ran the game. Sure enough, that fresh new blueprint ran without any problems: The component value persisted after the constructor ran.
What is happening here? Is there something I can do to "flush" the existing blueprint and have it rebuild its internal symbol lookup tables?
The long and short of it is that I have a component which gets initialized in the C++ constructor and is allocated memory. As soon as the constructor completes, that memory is deleted and set to NULL.
I thought that for sure, this component is being garbage collected and I triple checked it. I even stepped through the engine side code, line by line, especially in the garbage collector, and I did not see my component in the collection queue. Something else is happening and my component is getting deleted and set to null, and I can't seem to find where its happening.
I tried deleting all of my intermediate files and DDC. This had zero effect. The result was the same.
However, if I rename my component from "MyComponent" to "MyComponent2", it works perfectly fine.
If I rename MyComponent2 back to MyComponent, it gets deleted again.
I have even set my component to private and created a const "GetMyComponent() const" getter method to make sure that no other class is messing around with the component. This makes no difference.
I suspect that there is something happening internally within the blueprint, where a stale value or symbol is getting stomped. To test this hypothesis, I left the component name unchanged, so that it would 'fail' and get set to null after the class constructor has completed. Then I created a brand new blueprint which inherited from the same base class and ran the game. Sure enough, that fresh new blueprint ran without any problems: The component value persisted after the constructor ran.
What is happening here? Is there something I can do to "flush" the existing blueprint and have it rebuild its internal symbol lookup tables?
Comment