To repro:
1: Make a subclass of the Native DamageType called “DamageBase” in BP.
2: Add a function called “TheFunction” to that class that passes a variable of type “Actor”
3: Make a subclass of DamageBase and attempt to override “TheFunction” with a call to the parent.
4: Notice it will create the parent function call node but if you hook it up and compile you will get this error:
“Function Parent: The Function can modify state and cannot be called on ‘self’ because it is a read-only Target in this context”
I’m not sure if there’s something I’m doing wrong here but I would like to be able to put functionality into the base of my damage types and call them from children.
Hello ,
The tooltip for damage type states that they are to be treated as “immutable data holders with static code functionality”
I’m no programmer, but when researching what immutable meant I came across this: “The key concept is to understand that instead of modifying something you create something new with your change applied” (Understanding Immutability and Pure Functions (for OOP) · David Raab)
In this video it looks like he is putting functionality in the parent damage class, and using the children to hold information about the type of damage.
Hope that helps!
I figured it was something like along these lines. I ended up moving my functionality into another class.
It would be ideal if BP communicated the concept of an immutable somehow either through the icon in the generic browser and/or by giving some contextual feedback in the BP window. The tooltip is difficult to discover.