0 votes

Hi, I have a very strange problem, I have a scene with a ColorRect with a transparency of 50% when I do an addChild () of that scene in another scene, the color looks opaque without the transparency. I tried making a texture with a transparent png and the same thing happens to me.

If I add the scene in the editor and not by code the transparency if it works

I don't understand why this happens.

my code is:

var lose_scn = load("res://screens/lose.tscn")
add_child(lose_scn.instance())

Video: https://drive.google.com/file/d/1xdnRVffu8OLn0rgVPxUUKCET_ih_ZYLK/view?usp=sharing

I appreciate the help

Godot version 3.2.3
in Engine by (12 points)

I cannot reproduce this.

  • I created a scene of Other Node ColorRect. Set its color to a red transparency.
  • Attached/Linked it on top of ie HSlider positioned (0,0) in my main scene to check its transparency: OK
  • Next added a script to my main scene
  • Now both are over the same HSlider with a little overlap
  • The HSlider is visible and transparencies blend/add up

Code

func _ready():
    var lose_scn = load("res://transparent-rect.tscn")
    var o = lose_scn.instance()
    add_child(o)
    o.rect_position.x = 10

Is it possible the scene you are loading is not the same scene as you expect?

Tried adding the code in the _ready and the transparency if it works. Maybe the problem is because the scene is being added in a function called "lose" which is called from another scene like this

get_node ("/root/word").lose()

Keep investigating

I'm a fool, the problem was that the scene was added after a collision, this collision crept many times so when many scenes were created they overlapped haha.

Thanks for the help

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.