I am overriding the OnPaint function of a widget to draw a line from the widget to the actor it is attached to. I created a test project to do this, and I was able to make it work. It draws a line from a point in the widget that I can set to the center of the actor component (usually the default scene root). I created the widget class in both blueprint and in C++, which gave the same results.
When I took these classes to a different project, the results from the two classes were both wrong and different. The blueprint version didn’t even had a line, and the C++ version had wrong line position and length(it was too long). What could be the reason for this and how can I fix it?