As shown below, if a public method of ClassA with unrelated properties is called from ClassB, an incorrect value will be obtained.
environment:
VRCSDK: VRCSDK3-WORLD-2021.07.12.18.53_Public
UdonSharp: v0.20.0
code:
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class ClassA : UdonSharpBehaviour
{
bool _foo;
bool Foo
{
set { _foo = value; }
get => _foo;
}
int _bar;
int Bar
{
set { _bar = value; }
get => _bar;
}
public bool GetBoolValue()
{
bool boolValue = true;
Debug.Log("[ClassA] boolValue = " + boolValue.ToString());
return boolValue;
}
public int GetIntValue()
{
int intValue = 12345;
Debug.Log("[ClassA] intValue = " + intValue.ToString());
return intValue;
}
}
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class ClassB : UdonSharpBehaviour
{
[SerializeField] ClassA _classA;
public override void Interact()
{
Debug.Log("[ClassB] _classA.GetBoolValue() = " + _classA.GetBoolValue());
Debug.Log("[ClassB] _classA.GetIntValue() = " + _classA.GetIntValue());
}
}
As shown below, if a public method of ClassA with unrelated properties is called from ClassB, an incorrect value will be obtained.
environment:
code:
result:
Note that when I removed these properties from ClassA, the correct values were obtained.