Interactive Objects break after being cloned/instanciated on live worlds.
P
Pint
Description:
If an interactive object is cloned with VRCInstantiate, both the cloned object and the original object will lose interactivity.
Reproduction:
This can be reproduced by creating a 3d cube gameobject on layer 8/Interactive with a Udon script that has an Interact event in it. Then, in a separate gameobject, create a Udon script that uses VRCInstantiate on the gameobject (through public variables) after the Start event.
In the images below, the graphs ordered by when they were mentioned. The graph in the first image should be set to a gameobject #1 and the one in the second image should be set to gameobject #2. Then, the variable should be set to gameobject #1. Gameobject #1 should be a 3D cube (this is not necessary), and #2 should be an Empty (again, not necessary).
Other info:
This error only occurs on live worlds. Local testing works as expected (both objects are interactable). This can create very confusing errors and broken worlds.
Tested Version: VRCSDK3+UDON-2020.04.01.10.20.
Log In
YukimuraKyoko
[In UdonSharp]
I did my own version of having 20 ish Interactables to each instantiates different "Prefabs" using the same udonbehavior/script.
Just like you said this works as expected in local build but not in live build. However when I leave one of the prefabs in the Scene and instantiate that one instead, it works. BUT, I only did that to ONE of the 20ish objects, yet ALL of them works.
The 19ish other objects still spawns Prefabs from the assets just fine, and one object spawns a Scene object. So.... I'm just really confused as to why this is happening. I mean it works but not sure why it happened to all other prefab instantiates.
Edit: After I did a re-upload again, now only the changed instantiated object works. I wasn't sure why it was affecting all of them last time.
Also when I tried grabbing an object from a friend's hand, it duplicates, and if they instantiate objects a few times, objects fly everywhere and we both crash.
Shaun
Whatever this bug is seems to affect SDK2 as well, I've run into it in a few places like the Cards Against Humanity world. I can see the objects spawning, but I can't interact with them or pick them up and I can't see other people picking them up either. This has been happening since the 2020.1.1 update.
EDIT: Possibly related? https://vrchat.canny.io/bug-reports/p/objectsync-pickup-eventhandle-removed-on-object-spawn
EDIT 2: This bug seems to be caused by having your "first" world (either your home or the world you launch vrchat with through the website) be an SDK3 world. If your first world is an SDK2 world, pickups work as expected.
Cake․
Also, I would like to add that the logs say this:
[Always] Removing VRCPickup comp from original
[Always] Removing VRCSpatialAudioSource comp from original
This gets logged on an uploaded world just before the cloning happens, resulting in a useless original and clone.
You can use the original until the cloning occurs just fine.
However, as mentioned in the canny, nothing like this gets logged in local testing, it just works in there as one would expect.
As logs show, other components may be affected as well.
P
Pint
I can't seem to edit this so I'll put it in a comment. This issue seems to also occur with OnTriggerEnter, although I can't test to make sure because I am having other issues with OnTriggerEnter. I have working instantiated objects that run correctly in local testing but do nothing in live testing. I think it may be worth it to also investigate other events.