Private Property evaluates inconsistent results via a reference
Uzer Tekton
SDK
3.10.5
See below code, it outputs "false, true, true" (and vice versa) which is obviously wrong.
However if the property is
public
it outputs "true, true, true" as expected.using UdonSharp;
using UnityEngine;
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class WhyPropertyNoWork : UdonSharpBehaviour
{
private int state;
private const int TestState = 3;
private bool IsTestState
{
get { return state == TestState; }
set { }
}
private WhyPropertyNoWork _whyThis;
private void Start()
{
state = TestState;
_whyThis = this;
}
public override void Interact()
{
Debug.Log(
$"TESTTEST, _whyThis.IsTestState={_whyThis.IsTestState}, IsTestState={IsTestState}, _whyThis.IsTestState={_whyThis.IsTestState}");
if (state == 3)
state = 0;
else
state = TestState;
}
}
Photo Viewer
View photos in a modal
Log In