How to set alpha of color with Instance Recolor

How can I set the alpha of the color in Instance Recolor? There is no function to do it and it just shows the set color which I cant figure out a way to put alpha in

Edit: Couldnt figure out a way to do it easily, made a feature request for it

1 Like

Hi @ImABoy1286 good to see you again :sunglasses:

I’m unfamiliar with the term “Instance Recolor”, is this an object or function in RecRoom studio? I am able to set the alpha of a sprite using the canvas renderer component as a float value.

Hmm, I searched around for functions inside the game object tab and I could not find anything that could control a materials color, let alone alpha. This should already be a feature! Hmm… :thinking:

Instance recolor is a component that you can add onto an object that has the color. That’s what im talking about
Im not on pc right now or id send an image

1 Like

Alright, now that I’m on pc, this is the component I’m using
image
and these are the methods
image
I dont think there is a way to do alpha ig, Ill make a feature request

1 Like

Can you set the color via Studio Function by inputting separate constants for R, G, B, and A?

1 Like

You can if you are setting it to a constant in unity but there is no way to dynamically set the alpha with cv2 that I know of

1 Like

Have you tried using an animator? I’m not sure if it’d let you set the alpha independently, but it’s worth giving it a shot. What I’d do is create an AnimationClip for your object with the Instance Recolor component, have the start of the animation at 0% alpha (transparent), the end at 100% (opaque). Make sure you go into curves and set the animation curve to a linear one. After that, I believe you should be able to set the “MotionTime” parameter on your animator state using Studio functions (in a nutshell, MotionTime dictates the progress through that animation’s motion. 1 being fully complete, 0 being the start of the animation). If everything is set up right, the MotionTime you pass in will directly correspond to the alpha / opacity.

EDIT: after looking into this more, this appears to be fully possible!

image

After you add InstanceRecolor.Color as a property of your animator, you can remove the individual R, G, B properties, leaving you with control of the alpha without altering the actual color.

Here’s a GIF of it in action in the Unity Editor, I can’t test it in-game, but it should work:

alphaViaAnimation

When I scrub along my AnimationClip’s timeline, you can see the Alpha (the white / black bar under the color) changing within the Instance Recolor component.