Hello.
I have 2 blueprints that can interact with one another via a reference. I have text objects in 1 BP and I want to toggle visibility from another BP. I created a ref to the BP with the text objects and can drag out of ref node and type the text variable name to toggle (see screenshot)
Debugging the code fires correctly but the text doesnt change 1 should go off and 1 should turn on. I’ve seen this in other online videos for text toggling a light on/off but my isnt working?
Any thoughts?
Cheers!
Rick…
@RickJ61 Any errors in the log? Access None perhaps? If you print the Display Name of the RPICRef (the reference you created, I presume), what do you get?
Flip Flop isnt needed…for kicks I tried anyway and it did not change anything.
As for print string I already did that no errors and value returned was RPICRef blueprint. I had even done the text display name and those are valid as well??? I’m totally stumped as to why this isnt working. Maybe one cannot control objects from 1 BP to another BP?
Rick…
Disclaimer: I’ve not exactly had caffeine this morning due to early meeting, and I usually live more in the C++ side of things than the Blueprint side. So, apologies if my brain might not be entirely firing on all cylinders yet.
ANYWAY… at a cursory glance, that looks to me like it’s only going to fire the toggle on one of those two scene components. And I honestly have no idea which. Or, really, what’s going to get passed to the underlying function as ‘target’ there. At any rate, I’d try making two Toggle Visibility nodes, one after the other, with Power On Text going into one and Takeoff Text going into the other. Just to sanity check, if nothing else.
(If that’s not the case and you can indeed pass multiple targets to a node to have it called multiple times on multiple things… neat, new shortcut trick learned for the next time I need to wander into Blueprints! And now, I’m going to go find caffeine…)
Thanks for the replies!
Yes I have done all sorts of debugging with prints and using isValid node. They both report true so 1 was firing and the power text not so much. I split them to be separate Toggle Visibility nodes and even that did help. I also tried directly with Set Visibility that didnt change the text from displaying. Here is funny thing I removed the being able to press the key more than once and they both get shown as false the second time through but the text objects do not change power text is still visible. So maybe a display issue not refreshing?
If I understand your 1 question on number of actors within the BP there are 9 objects 5 of which are varying text I wish to display at various times to inform the player what key to hit next.
Thanks Rick…
Well an update and it appears to be an issue of toggling an object from 1 BP to another. I placed a little duplicate code in the BP where the objects are and ran the code and it toggled text off and other text on. @Packetdancer hopefully you found your caffeine!!! and for your future knowledge it does work assigning both objects to a single Toggle Visibility node.
So I now have the question is this expected behavior or a defect assigning values to objects in 1 BP from another BP? I would think it would be allowed.
So I now have the question is this expected behavior or a defect assigning values to objects in 1 BP from another BP? I would think it would be allowed.
It is allowed, the bread & butter of OOP. The thing is, if you put it in a clean projects, it works. The question is what other, uncanny things are going on under the hood?
If I understand your 1 question on number of actors within the BP there are 9 objects 5 of which are varying text I wish to display at various times to inform the player what key to hit next.
can you show how you assign value to the reference variable?
can we see what triggers the execution chain for those nodes?
As much as I agree with this, it should still work. And it does, just not in the OP’s example. There’s something dodgy behind it all. My gut feeling is telling me that we’re affecting components of another actor, not the one OP is observing.
The ref is a public variable that is then assigned on the actor that is needed to fire off events. I am getting valid returns on the objects using an Is Valid node so it should be working.
The code is triggered by a key press. The text essentially is to inform the “player” what to do next (hit a different key) to execute.
Yes a single Toggle Visibility node is firing both when within the BP that has the objects to toggle but does nothing from the other BP as I would like.
This is not anything complex this is a simulated flight pattern of a drone that powers on, takes off, flies a mission (along a spline), lands and powers off all with key presses for each task.
Cheers!
Rick…
Not understanding all of this? OP’s example? I have 3 BPs the spline (flight path), the drone and the character controlling the drone. I now see I have to rethink the architecture as I did not realize you cannot have a ref on a spawning character it is there on the character but not set initially I can set it manually during debug and I finally get a valid return value but still not firing the toggle or actually I should say not refreshing the display because the text objects visibility is set correctly. Very confusing so I do not mean to confuse you all here within this post.
Rick…
But you can, you can set references dynamically. Anyway, in an isolated scenario, this works more than fine:
The visibility of the meshes is triggered by an actor the meshes do not belong to. There is something about the setup you’re using we do not know. And it’s critical here.
I’m not sure what to think now. All I did was create a new project from third person template and swap out my character (from mixamo) for the mannequin and add this code to perform certain actions in the respective BPs. Again character, drone and spline. The character has a tablet in hand and text is supposed to change leading the player through the flight process…power on, takeoff, fly mission, land and finally power off. Everything is working perfectly except text not changing as expected. That and the fact that apparently you cannot have a ref on a spawning character as its initial value is none and setting it during runtime finds the object because I can print its display name and visibility value but the toggle is not refreshing display. As I said they are true then false as expected with the multiple key presses.
Thanks again.
Rick…
Thanks for this tip! No it appears where I placed the actor before it spawns into the scene. This is indeed an issue with spawning a character. I guess I need to try and spawn the text at location on the tablet during play and not have predefined. The character shown is a place holder only.
Screenshots attached. First one is placement in scene and second is where it gets spawned on game start. The yellow dot is where text actually is and where it should be upon play.