hmmm. If you create a copy of the class BP as an asset (or a child class C ++) you can override the function in the child class.
Option 2: You cannot redefine the function for the copy of actor in the scene, but you can put behavioral functions in its implementation. For example, check the pointer to which actor you got.
Hmm sounds like you’d need to manipulate a delegate from the panel window of an instance, but I’m pretty sure that the engine doesn’t support that.
It’s possible that what you’re trying to do needs some refining instead of trying to implement it as-is. For instance, even if there were a good solution to your problem, it may not be a good idea to have a button be able to call a function on any actor in the level.
That being said, here is a quick and dirty solution for what you’re trying to do:
(Assuming you have an OnClick delegate in your button class that you need to change as needed)
1- Create an enum with as many entries as there are possible functions that you’d want to call (+1 for “unknown”?). (Don’t forget to use UENUM() to make it visible in BP)
2- Create a map (enum, delegate) somewhere accessible from your button class. Populate it with your potential function delegates.
3- In your button class, create a function called SetOnClickDelegate that… changes the OnClick delegate. This takes in parameter a value of the enum we just created.
4- In your button BP or class, have an enum UPROPERTY() to store the current enum value for the button, and another to store the previous value. Those properties must be editable from the instance panel.
5- In your button BP constructor, if the enum value changes (CurrentEnum != OldEnum), call GetAllActorsOfClass, and call SetOnClickDelegate on all of them with the new enum value as the parameter.
4- The newly created function gets the delegate from the map, using the enum function parameter as the key. The OnClick delegate is then set using the delegate found in the map.
It’s a bit rough and you need to know in advance what delegates you may need, but it does the job.
Though I don’t really get why you need to change the delgate on all the instances directly in the editor panel, as you’d simply need to change the code of the class once, in order to do that.
PS: I’m not recommending that you actually use that way of doing things. Rather, it’ll help you realize the volume of work needed to make your initial request work.
You could create your own system using CallFunctionByNameWithArguments. This would basically allow you to build a push system where the button instances can be dynamically programmed to call an arbitrary function on some UObject somewhere, in your case maybe the touching actor.