I have custom classes Primitive and PrimitiveBox. I am trying to use the set() method to set the value of the width data member.<br /><br />
<br />Primitive *primitive = memnew(PrimitiveBox);<br /><br />...<br /><br />String name = &quot;width&quot;;<br />Variant value = 5;<br /><br />primitive-&gt;set(name, value);<br />
<br /><br />Here are the relevant parts of PrimitiveBox's definition:<br /><br />
<br />class PrimitiveBox : public Primitive {<br />&nbsp; OBJ_TYPE(PrimitiveBox, Primitive);<br /><br /> private:<br />&nbsp; float width;<br /><br />...<br /><br />};<br />
<br /><br />I can provide more code if requested.<br /><br />By pausing and observing the value of "width" in GDB, I can verify that it does NOT change from the value I assign it in PrimitiveBox's constructor.<br /><br />What do I need to do to get set() to function? I've looked at calls to set() in Godot's codebase, but I can't see what allows those calls to work.<br /><br />Before someone suggests it, a set_width() method could work, but it wouldn't be ideal. I may end up implementing a Primitive that doesn't have a width, for example.