GameObjects are invisible for no reason (SOLVED)

Hey! I have a weird bug - game objects of some type (somefile.go) are just invisible in game.

editor:

game:

Purple ones are just sprites. Green ones are .go instances (just sprite). Materials are the same. Blend modes also same.
It’s not z-order problem. Tried rebuild. Tried close Defold - open again. Didn’t help.
Have no clue what’s this.

Workaround: just recreate that .go file and use it.
Reproduce: just take a look at my ‘test2’ project. ‘bug with gem.go invisibility’

Thanks :slight_smile:

1 Like

I am almost 100% certain this is a depth issue. Please read the answer in this thread: [Help] Newbie question: Setting up layers with Z Index (SOLVED)

print(go.get_world_position()) shows these:

DEBUG:SCRIPT: vmath.vector3(617.08325195312, 191.84991455078, 1)
DEBUG:SCRIPT: vmath.vector3(911.01770019531, 495.70236206055, 1)
DEBUG:SCRIPT: vmath.vector3(1025.7922363281, 495.70236206055, 1)

Z is in [-1, 1] range.

As I said it’s not z-order problem, since world’s z is in [-1, 1] and there is no overlap for some of the sprites.
I don’t know projection matrix of renderer, will check today’s evening. Really looks like sprites are getting culled after projection multiplication (indeed out of [-1,1] range in NDC.z coordinate). But it’s z == 1 in world space (also tried z == 0, same result)

Found some additional details / workaround / proofs that this is a bug:

  • I go to gem.go file.
  • delete script component and save
  • run - it’s still invisible
  • set position of sprite to 100 (was 0) - save
  • run - it’s still invisible
  • set position of sprite to 0 back (was 100) - save
  • run - it’s VISIBLE! (world coords are the same. maybe this is world coords of game object, not sprite?)

Checked several times - so change z coord of sprite to some random value and then to 0 back - fixes the issue. Sounds like a bug, guys

After you made it visible (changed pos back to 0), can you make it invisible again?

Yes, I just change that to 100 again and it will be invisible with some probability. I mean - it’s not always works like that, reproduce rate is not 100%.

I have the very same issue. when I create new instances of the invisible GOs with the same properties, I can see them but then with no changes to them are suddenly invisible.
When I preview the main collection the GOs are there, but then when I run the project the GOs dissapear.

It’s most likely a Z order issue, but can you share or post a project where this happens?

Do you mean run-time creation using a factory or simply duplicating them in a collection in the editor?

It is with almost 100% probability that it is like @sicher says, a z-order issue. The default render script accepts a range from -1.0 to 1.0. If a game object is on z=0.5 and a sprite component on the game object is given z=0.6 then you’ll have an aggregated z value of 1.1 and it is thus outside the range of what the render script will draw, but still visible in the scene editor since it doesn’t take into account the render script.

1 Like

you are right. In my case it was the z range. Thanks!

3 Likes

Not sure why this is marked as solved. Jura’s original post is not solved. I have the same issue and can reproduce similarly. This is the default spaceship tutorial so it’s not a z-order issue at all. The game objects go invisible. It is not a driver issue - Intel graphics driver utility mentions I have the most up-to-date.

the original issue was posted almost seven years ago so you might be facing something different perhaps. What version are you on?

2 Likes

So the sprite components are not visible and you are seeing a black screen? And you are using Windows?

it is an important thing that every newcomer must know!
I suggest mentioning that in the building block of defold or somewhere in the initial tutorials.

We do mention it here: Game object components