VRCObjectSync.SetGravity/SetKinematic causes exception in SDK3.5.2
needs more information
yoshio_will
The code below works in SDK 3.5.1, but not in SDK 3.5.2, in Unity editor.
(It causes an 'Object reference not set to an instance of an object' exception.)
(using VRC.SDK3.Components;)
VRCObjectSync sync = GetComponent<VRCObjectSync>();
sync.SetGravity(true);
This issue occurs even though the 'sync' variable is not null.
Log In
yoshio_will
I have identified the exact steps to reproduce the issue.
- Create a GameObject with VRCObjectSync, Rigidbody, and Collider.
- Set the GameObject created in Step 1 to inactive.
- On a different GameObject, attach an UdonBehaviour that has the following code when interacted with:
public override void Interact()
{
VRCObjectSync sync = tgt.GetComponent<VRCObjectSync>(); // tgt = GameObject from Step 1
tgt.SetActive(true);
sync.SetGravity(true);
sync.SetKinematic(false);
}
- Enter Play mode, and Interact with the GameObject created in Step 3. It functions as expected.
- Attach any component with [UdonBehaviourSyncMode(BehaviourSyncMode.Continuous)] to the GameObject created in Step 1.
- Enter Play mode, and Interact with the GameObject created in Step 3. An exception occurs.
This issue was reproduced in SDK 3.7.5. It does not occur (works fine) in SDK 3.7.1.
Please fix this.
yoshio_will
Additional validation result
3.7.2 : OK
3.7.3 : OK
3.7.4 : NG
Hoshou Neko
3.7.4 Live and we still dont have a fix.
in unity it throws exception, but manages to change kinematic state.
in game it doesnt produce exception, but doesnt change kinematic state.
pls fix
yoshio_will
Confirmed that problem is no longer exist in sdk 3.6.0. Thanks for the fix!
yoshio_will
Wait, it's looks still reproduceable, I'll check. It'll be...
- Create inactive GameObject that has VRCObjectSync
- VRCObjectSync.SetGravity from other active GameObject
- Exception
yoshio_will
I've test that on some SDK versions, and here is result:
3.5.0 : Reproduced
3.5.1 : Reproduced
3.5.2 : Reproduced Unless VRCObjectSync GameObject is enabled
3.6.0 : Reproduced
3.6.1 : Reproduced
3.7.0 : Reproduced
3.7.1 : Reproduced
3.7.2 : Reproduced
3.7.3 : Reproduced
3.7.4 : Reproduced
3.7.5 : Reproduced
and here is code:
using VRC.SDK3.Components;
public class SetGravityKinematicTest : UdonSharpBehaviour
{
public VRCObjectSync sync; // set your disabled VRCObjectSync thing
public override void Interact()
{
sync.SetGravity(true);
sync.SetKinematic(false);
}
}
I wonder if VRCObjectSync gets that's own Rigidbody in Start(), but disabled VRCObjectSync dont have it, so causes exception.
White Lotuz
needs more information
Hey there, can you check on the latest SDK version?
_
_tau_
Can you test this on the 3.6.0-beta.1 open-beta version? I believe it might contain a fix already.
StormRel
tracked