Same colored spawn objects between blueprints

Hi. I have 3 blueprints.One them is for Spawning.
The other 2 are for generating colored geometrical shapes and letters.
First I create random geometrical shape from a shapes list with a random color then I create a letter with a random color.
I want geometrical shape and letter have not same color because I can not see letter above geometrical shape.
Im attaching my blueprints how can I solve this issue.

Here is my work

Some Photos
My Letter and Geometrical Shapes Blueprints is same.

My Problem

My Spawn Object blueprint

If the color indices are the same for both the letters and shapes (i.e. Color option 1 on shapes is red, color option 1 on letters is also red) you could use a variable to store the color choice of the shape on each instance of the shape BP and when spawning the letter (or vice versa, can’t really understand your code language as to which spawns first and what not) have a check between the variables to make sure they aren’t the same, if they are have a custom event fire to repeat your “randomization” of the color until an appropriate color is chosen. Basically the logic is as follows:

  1. Spawn shape
  2. Set shape color
  3. Store color index as a variable on instance of Shape BP (i.e. color index 1 was chosen)
  4. On overlap set color of “Letter”, store color index chosen as variable on instance of Shape BP (i.e color 2 was chosen)
  5. Compare color indices between shape and letter (shape index is 1 : letter index is 2 → OK…skip step (6-7)
    “OR” Shape index is 1 : letter index is 1 → BAD!)
  6. If BAD use custom event or loop back to repeat code that sets the color of the letter.
  7. Repeat step 5 until “OK”

I sort of managed to do that what i want by following blueprint but still the color which has 0 index (red in my case) still appears on top of the red colored shape. For rest of the colors its ok. I need to make an exception to the 0 index but i am unable to do that. Thanks for answers.


i should make a branch just after the inputs:
if the input is 0 create random integer in range [1:9]
else (input is between [1:9]) do the above operations.
i tried to make it but i could not be able to do it.
i am very new to unreal engine.

I think you are over complicating the situation. That doesn’t make sense. Screen shot your blueprint that works for every number “except 0”. Then we will go from there.

My lazy way is to take the color of the shape and then assign the letter color as R: 1 - shape color’s R, G: 1 - shape color’s G, B: 1 - shape color’s B, A: 1.

This should work as long as nothing has R: 0.5, G: 0.5, B: 0.5 (gray) or close to it. It just makes the letter have the exact opposite color.