Set_color function on instantiated node not working from 4.1 to 4.2

Godot Version

v4.2.2.stable.official [15073afe3]

Question

I had some code that worked perfectly in version 4.1, but now that I’ve updated to the most recent version I’m getting an error. Specifically:
“Attempt to call function ‘set_color’ in base ‘null instance’ on a null instance.”

I’m trying to replicate how chat bubbles look on a phone, where they’re on either side of the screen. Everything worked perfectly in the previous version, and now in 4.2 if I just get rid of the set_color line, everything else still works perfectly. Why is that function failing now? Is there a different way to set the color of a node?

What does the scene tree for speech bubbles look like?

And just for a little more demonstration, this is what that exact same unchanged code looks like in 4.1

Sorry, I posted an incomplete scene tree before. This is the complete scene tree for speech bubble
speechBubble1

Thank you for your initial reply. It’s been a few weeks since I’ve worked in godot, but I figured it out. When running the scene, the rich text label generates an extra vscrollbar as a child that you don’t see in the editor until you look at the instance in the remote tab. That’s why my code is trying to change child(1) of the RichTextLabel. That new vscrollbar would normally become child(0). It looks like in godot 4.2 that vscrollbar is disabled by default, so my ColorRect is back to child(0)
4.2bar

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.