Using one blueprint asset inside another blueprint doesn't seam to work properly?

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:

    1. I can not find a good way to get a reference to the warning light. This was my my first attempt:

P2-objects.PNG

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)

  1. 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…)

  1. 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:

  1. Is this some kind of bug i found or is there a natural reason for this behaviour?
  2. 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

Hi,

I have the same / a similar problem.
See here: https://forums.unrealengine.com/showthread.php?68646-Still-a-problem-with-acessing-a-child-actor-component-s-variables

I havent found ananswer, but it seems that this is one of the limitations of UE4 that forces Epic to say “There is no full prefab system yet”.
If passing references and accessing component properties would be possible, then this would be equivalent to “Prefabs”…

Thanks for your reply. A limitation it certainly is. Does anybody know if this is possible to solve in C++?
And there is also the question about why it’s working when referencing objects in other blueprints but not when using references to the object in the own blueprint?!? (Se 3 above) This is certainly a strange behavior to me.

Thanks KVogler, i looked at one of your suggested solutions and voila. This works fine for me:

But the strange behavior around the reference variable is still unsolved. Although it don’t cause me problem any more it would still be nice to find out why?

Hmm… after cleaning up a bit after my experimenting i came to the same problem as KVogler, the meshes didn’t show up. A complete removal and re-insert by drag-drop fixed that.