Download

Function doesnt fired from parent widget constructor

Hey, I didn’t know where to post this, here or in C++ forum, It related to both blueprint widgets and C++
I have a widget class (Lets call it widget A) which inheret from C++ class that implement function Init
6e5c4a5ed4c0128eef34950d02519fa7ae8d39d0.png
From widget A constructor I call the function Init:
9e2385ab5d6ccf42aab98f8b7b8abcd76550f792.png
I have another widget blueprint which inherent from widget A (Lets call it widget B).
From widget B I call widget A constructor:
15f373ebbb1f68782d3512bc33e0516002b3391b.png

I have added the widget B to the viewport. The problem is that the function Init is not fired in the C++ code although the call to it is happans.
I have tried to debug from widget A constructor and I can see that the the blueprints reach and call to function Init but from the C++ code the function is not fired.

After that I have tried to add widget A to the viewport (instead of creating widget B and adding it to the viewport) and Init function is called fine.
Something with the inheritance of widget A from B makes the function Init not fire. Why? is that a bug?

Something I was reading earlier–correct me if I’m wrong, but widgets do not currently inherit functions from a parent widget…although, this would be a nice feature to have, and I’m confused as to why it doesn’t exist already.

The call to Init is fired from widget A (The parent widget) which means call to the base class, The call itself does not related to the inheret widget B

Does widget B inherit the Init function directly from C++ code, or is inheriting it from Widget A? I think it needs to inherit directly from the C++ code in this case. Widget B will not inherit functions from Widget A. Hope that makes sense and helps!