Imagien you have the following two blueprints:
-
A door which is opening when you come within a trigger volume
-
A rotating/flashin warning light that you can turn/on off with an event
Then you want a warning light by the door that flashes when the door opens and closes.
This works perfectly fine if you just drag in the blueprint for the warning light and the door to the level and “inform” the door about the warning light.
This will however be very tedious to do this for every door in your level, so why not put the warning light inside the door blueprint?
This is when things goes tricky:- I can not find a good way to get a reference to the warning light. This was my my first attempt:
Where the Warning Light blueprint have the SetState event implemented. But… the typecasting fails? (I know i can use BP interfaces but this won’t help)
- So i tried, just for testing, to access all Warning Light objects out there:
And this works fine (except that all warning lights on the level will flash…)
- So lets try with an object reference variable:
This is when things getting really interesting:
If i set the WarningLightReference to an actor that is just dragged in to the level things work fine. (But then we would be back to the original problem. We wanted the light to be inside the door BP).
If i select the light that is inside the door blueprint it doesn’t work. **BUT: **If i select a light inside another door BP it will work!?
So this will work:
How can this be? I tried the other way around as well with the same result, using the light from the own bp won’t work.
So my questions are:
- Is this some kind of bug i found or is there a natural reason for this behaviour?
- How do i properly reference the warning light blueprint inside the the door blueprint? Is it possible?
I haven’t found any examples of using bp’s inside other bp’s. Is it not supposed to work? Otherwise this will be a super useful function. (Ok, you can implement the warning light directly in the door BP but this means that you have do duplicate the code for all other things that needs a warning light.)
Any help around this would be much appreciated.
/Tomas