Changing another blueprint's mesh?

Hello. I have a nightvision system in place that requires tweaking another blueprint’s mesh.

Can someone look at my event graph and see why when I connect the “set material” node nothing happens (the one not connected). My custom event changes the other variables that are already on my character no problem, but not the one from another BP. (To be clear the variable “LazerColor” is correctly linked to its blueprint and I’m referencing a cylinder that’s on it.)

I’m pretty new so I’m sure it’s very obvious. Thanks!

Can you show where do you initialize the value for it? You do that, right? :kissing_smiling_eyes:

I’m sorry I miss typed earlier the name of my variable is LazerColor, and it is a blueprint object reference to “Lazer1”.

Also, when I click on the variable and go down to: “default value > Lazer Color” I can’t select anything. (Select actor in scene isn’t greyed out but it also doesn’t seem to work) Do I need to if I’m just referencing a material on the blueprint?

You need to “get all actors of a class” and choose the class of that actor and its index in the level. Then promote it to a variable. That is how you acquire a true reference to another actor.

1 Like

That’s what I’ve been looking for, I will try to implement it later today thank you so much.

We’ve been at it for 10 years. Why is it still being recommended? That node does not guarantee element order. Today it will get you one actor, tomorrow another, and yet another once you package…

It really is useful when:

  • you want to get ALL actors
  • there is only ONE actor
  • you could not care less about comms because you’re debugging, experimenting

In short: one cannot rely on it to fetch a specific actor instance :person_shrugging:

Tell us the right way.

Direct comms, event dispatchers, interface.

I never use those. They are too complicated.

OP’s pic already has direct comms. Have a look. Now you’ve got only 2 methods to master. And you’ve been using dispatchers without even knowing. And interfaces, too, probably.

Can you just put something from level to character bp?

If this is a single player game and this cone is just one in the level, you are safe to use get all actors of a class, otherwise use some of those other methods mentioned.

If I’m reading this correctly, you have a blueprint actor of some kind of type, let’s call it “BP_Lazer.”

  1. BP_Lazer has a static mesh component called “Cylinder”
  2. You have a variable in your Night Vision Blueprint called “Lazer Color,” and it’s type is “BP_Lazer object reference.”
  3. You actually HAVE an instance of BP_Lazer in your level, and you can see it in the outliner.
  4. You’re saying when you try to set “Lazer Color” IN THE OUTLINER… that your instance of BP_Lazer does NOT show up in the list?

Because I do this A LOT, and as long as you actually have an instance of what you want in your level, it WILL be listed for a variable object reference of the same type - it’s never failed me. The only time the list is empty is if there’s no instance in the level.

Do you get a run time error when you try this? If you’re unable to set the value in the outliner, you must be getting a runtime error (that the value is none). I do not think the graph you showed is the problem, I think it’s your reference to the instance of the BP in your level. Don’t use a soft reference, or anything else, just a plain object reference… it absolutely should work.

1 Like

Everything you believed to be true is true, but I do get this message.

“Blueprint Runtime Error: “Accessed None trying to read property LazerColor”. Node: Set Material Graph: EventGraph Function: Execute Ubergraph BP Third Person Character Blueprint: BP_ThirdPersonCharacter”

so its the reference thats the problem not the nodes right?

But you’ve clearly said you are unable to set it in the level outliner… the ONLY reason that should happen is because there’s not an instance in the level of what you’re trying to reference.

Of course you get a “none” error if you can’t even set it.

You need to figure out why you can’t set it. There must be something. I do this ALL the time (I don’t do games, I do virtual broadcast graphics, and life would be hell if I couldn’t use references).

Not sure what your asking in assumption #4.

Absolutely… let me get an image for you. Give me a minute.

1 Like

Very simple “BP_Lazer” with a static mesh cylinder:

Very simple “BP_NightVision” with a variable “Lazer Color” reference to BP_Lazer:

And you instance both of these in the level, then you can select the instance of BP_Lazer in the BP_NightVision blueprint:

In my example, you also need to set the BP_NightVision blueprint to receive input, but that’s just for this demonstration.

I think I understand everything you conveyed, but the code is on my player. If I followed your directions I would need to delete the code on my character, and reference the nightvisionBP to my player character too, correct? Sorry I’m new idk if that’s a dumb question.

Update: I added custom event called “characterref” that will work with which ever set of nodes it is plugged into. However, I don’t know how to make it work with the other character in the array.

So then I tried making the Variable LazerColor to an array and everything went crazy.

Help please thank you