I made a Blueprint Interface implemented in multiple different bps, so at 1 call x of them could responde and execute. Now, If I’m not wrong, I know is not possible to refer a local bp’s variable inside a BPI function. And I would use some nodes I collapsed into a normal function, I wrote inside a single bp, as response to the shared interface function. But I can’t call this local function from esternal bps, so I tought to create a function library to add this one and solve.
In your opinion, makes it sense? Or is there a better way to do the same thing? And also, if this local function uses variables contained only inside a single bp, Should I recreate each of them in other bps or UE do it in auto?
Ye this is what I’m trying to do
But I’ve never done before, I mean BPI that works within a function library.
Basically, of all the bp in which I have implemented the bpi, they would need 2 calls. One that executes a code that is the same for all (which is what I would put in the function library) and another call to execute codes that are distinct from each other. And I have some doubts about the library, because this local function uses variables that have been transmitted via another bpi. And I am not sure how I can reuse these precise variables inside a function library. And also, the function I created locally, do I have to recreate it from 0 in the library, or is there a way to “convert” it from local to global?
The BPI call only sends a signal. It’s up to the blueprint to decide what to do with it, and may include
1 Nothing
2 Running code that calls part of a function library
If you’re running two interfaces, one for the main call, and one for the distinct stuff, you’re missing the point of BPIs. The whole reason for having BPIs, is you should not know what is happening inside the blueprint. Whether a given blueprint calls stuff or not, is no business of the BPI.
I think local variables are part of a function library, you don’t need to worry about that
No, you need to put a copy in the library, and go back to all the blueprints that call it and replace that part.
I mean, inside the same BPI, I made 2 functions. And I use them to trigger(call) 2 actions. One is equal for all of bps (for this I tought bpi+function in library) and the second one is different for each of them. Infact I’m not worried about the second one. I’m a bit confused about the library.
You can have as many calls in a BPI as you like, of course.
You’ve right here, one BPI call, which can have different implementations in each blueprint, this is correct
Function libraries are not related to BPIs. If you have to keep writing a function in your blueprints call something like ‘find nearest door’. It just makes sense to define this in a function library, because then you can just call it anywhere you want, and you don’t have to keep manually tell each blueprint how to do it.
Thank you sir, anyway. I’m feeling a bit stupid rn to be honest ahah because, if i go it, I just have to define my “local variables” as input/output. Right?
I created a bp that has the sole purpose of doing all the get to obtain valid references of the most important bps. So as to avoid having to do the same get actor of class x times towards the same target, in y bps. So, this bp, has a local function with which it takes, validates and then transmits the refs to the bps that need them. This has to do with the first point, because, the refs are transmitted in arrays to avoid overwriting, and when the call arrives they must similarly filter the refs, keeping them all in a temporary array for future use with the exception of the self ref. Instead, the second call concerns a bp that identifies the current lvl and transmits it without a prefix, so that then each bp that receives , uses the current lvl to compile maps, in its own way, which I need to avoid/deactivate assets not related to the level.
In the first case, if the BPI is passing references of type ‘actor’ then that sounds ok. If it’s passing specific types, then there’s no point in using a BPI
If an array arrives from the BPI, it’s fine to copy it into a local array, of course. In fact a local copy is automatically made as part of the call, so you don’t have to explicitly do it. The different BPI calls will not get muddled up.
[quote=“ClockworkOcean, post:11, topic:2479422, username:ClockworkOcean”]
will not get muddled up.
AH
So I don’t risk overwriting, if I send them as single instead of array? And for the function to be rebuilt in the library, I basically just have to “rewrite” it there?
I rewrote the function code in the library, but now I have a warning on the self reference node “cannot be used in a static function”. And I have an error on the array I recreated, which says “SaveBpRefs.Bp_Valid_List is not blueprint visible (BlueprintReadOnly or BlueprintReadWrite). Please fix mark up or cease accessing as this will be made an error in a future release”, but I don’t have these settings from here??
I solved this one just using a diff name for the var inside the function and the var in the return node. But the self ref warning is still there and some data is lost during the global function. Suggestions? @ClockworkOcean
Basically I’m trying to keep the bp still until they have received the main refs (of those bps that are closely related to each other for the functions they perform) and until they have received the current level. So the self ref I wanted to refer to the “current” bp that responds to the call and then performs the function. Where simply among the refs it has received it filters its own ref.