decentraland / unity-renderer

Unity implementation of Decentraland Client
https://play.decentraland.org
Apache License 2.0
137 stars 93 forks source link

Far-away scene objects can appear in current player position #638

Closed pravusjif closed 3 years ago

pravusjif commented 3 years ago

@nearnshaw reported that it looks like some entities are appearing not just outside the scenes they should be in, but they’re being loaded KILOMETERS AWAY from the scene they belong to.

They don’t appear consistently always, but when clearing cache it looks like it gets fixed.

It doesn’t happen everywhere, it looks like it only happens with the casino scenes and especially with the new under the sea casino that they’re about to release. This scene is not published for everyone, it checks the player id against a whitelist and only renders things when you’re in the list. So to see this inaction, contact @nearnshaw to be whitelisted into the scene.

Once whitelisted, steps to reproduce:

  1. Visit the new casino: https://play.decentraland.org/?position=-139%2C127&realm=fenrir-amber
  2. Walk outside, about 50% of the time you’ll already see a fish model outside, rendered in a road parcel that is a separate scene. If you don’t see it, reload a couple of times till you do:

image (6).png

The entities can load even farther away. After visiting that scene, if you go to genesis plaza, you might also see the fish on the ground in the middle of the bar, keep in mind that the scene this fish belongs to is at -138, 127. Nothing from that scene should be rendered when you’re in genesis plaza:

image (7).png

Also it seems that in the same spot in front of the casino where you see the fish, you can sometimes see a casino slot machine. This slot machine isn’t used anywhere on the casino you see infront. This machine belongs to the Tominoya casino, that’s also very far away:

image (8).png

We've only seen this issue with the casino scenes, it might be something wrong on the scenes code. But clearly this exposes a big vulnerability that could be maliciously exploited, and could even be a clue to how to optimize the use of memory.

We should debug wha's going on there, maybe they are appearing in the unity-world 0,0 position as it used to happen a long time ago?

D4rWiNSS commented 3 years ago

I think that this issue is relate to #389 from builder in world, The issue comes from the Object Pool!

I think that the problem comes when an object is not initialized correctly in the poolmanager and it is not deactivated. I has been able to reproduce it with a builder in world object

image.png

This item should have a collider but the collider component doesn't exists

image.png

As you can see there is another object with the collider,

image.png

AjimenezDCL commented 3 years ago

This PR: https://github.com/decentraland/unity-renderer/pull/746

Should fix the issue.