Base Color defined by variable in Level Blueprint

Hello! So I’m not sure if my approach to this task is using the correct logic, but here’s what I’m trying to do:

Upon launch, 1 of 7 predefined colors is chosen, and applied to an assortment of materials in my level.

In my level blueprint, I first have a random integer chosen between 1 and 7. I then go through a series of IF statements, checking which number was randomly chosen. As soon as a branch is triggered as TRUE, a Linear Color Variable, “StartingRoomColor” is set to the corresponding color.

Question 1) If I want to use the variable “StartingRoomColor” as a base color on several materials, do I control this in the materials themselves, or do I have to setup a blueprint on objects that have those materials applied to them, and control it through dynamic material mumbo jumbo?

Question 2) How? I’m happy to follow tutorials or read documentation, but I’m not sure what terminology to search for to do this process.

[More info]
My level blueprint may not be the most elegant approach to this, but the reason I set it up this way is so that I can expand upon it later for a puzzle element I plan on implementing. For example, if my StartingColorID variable is 1 (white), I will have logic in the level telling other materials to display as StartincColorID +1 (red).

Thanks for your time =)

I’ll help you out, Just give me a few minutes to construct the blueprint and post screenshots.

Thanks! I suppose I could have simplified this question and removed the random ID part of it. Essentially I just need to know how to reference that Linear Color Variable from within either a material or a different blueprint.

First of all, you need to store this information with a persistent acto, the game mode or player character would be appropriate. I chose the Game Mode. Here is how I wired it:

Thank you for taking the time to set that up, alperenakyuz. I think I should be able to follow that example fine enough, but may I ask you some questions about it?

  1. What is the advantage doing the randomization blueprint in the game mode/player character BP?

  2. In your second image you have a BP network on the MyCharacter component (is that correct?). Would I create this network on which ever object I wanted this material to be applied on? Or does it automatically alter any instance of the named material in the scene?

Thanks again, I’ll give this a try when I get home tonight.

Alright so I’ve had some time to play around with this, and I see the answer to #2 in my above post. I hadn’t noticed that Mesh reference when I glanced at this earlier.

Unfortunately I am unable to get the results I’m looking for because I need my target to be a blueprint and not a mesh. I’m not sure how to handle that.

Example: I have a blueprint, lets call it “RoomBP”, which contains other blueprints such as “DoorBP”, “WallBP”, etc, each of which contains multiple mesh objects. Each of these mesh objects share a material, and I was hoping I could script something at the RoomBP level to basically say “every instance of this material within this blueprint, use this new color”.

Throughout the level I would be spawning multiple instances of RoomBP, and I would need each to use a different color.

Is this possible? Is my question beyond the scope of what this answerhub is intended to handle?

Because this question seems to be more complicated than I originally expected, I have redirected it to the forums, here. If I solve the issue I’ll mark this post as the answer so anyone who ends up here in search of answers can find it.

Hey again, I’ve been away for quite a while. Have you found an answer or should I attempt one?

I haven’t been able to solve this, so I re-strucutred my scene to avoid the question altogether. now instead of blueprints inside of blueprints, I just have a singular blueprint that contains all the mesh.