diff --git a/Assets/UdonSharp/Editor/UdonSharpPropertyVisitor.cs b/Assets/UdonSharp/Editor/UdonSharpPropertyVisitor.cs index cd672cdd..3786f3b4 100644 --- a/Assets/UdonSharp/Editor/UdonSharpPropertyVisitor.cs +++ b/Assets/UdonSharp/Editor/UdonSharpPropertyVisitor.cs @@ -41,9 +41,9 @@ public override void VisitPropertyDeclaration(PropertyDeclarationSyntax node) { foreach (AttributeListSyntax attributes in node.AttributeLists) { - foreach (AttributeSyntax attribute in attributes.Attributes) + if (attributes.Target != null && attributes.Target.Identifier.Kind() == SyntaxKind.FieldKeyword) { - if (attributes.Target.Identifier.Kind() == SyntaxKind.FieldKeyword) + foreach (AttributeSyntax attribute in attributes.Attributes) { using (ExpressionCaptureScope attributeTypeCapture = new ExpressionCaptureScope(visitorContext, null)) { diff --git a/Assets/UdonSharp/Tests/TestScripts/Core/PropertyTest.cs b/Assets/UdonSharp/Tests/TestScripts/Core/PropertyTest.cs index 15a7629e..b144ffc4 100644 --- a/Assets/UdonSharp/Tests/TestScripts/Core/PropertyTest.cs +++ b/Assets/UdonSharp/Tests/TestScripts/Core/PropertyTest.cs @@ -1,4 +1,5 @@  +using JetBrains.Annotations; using UdonSharp; using UnityEngine; using VRC.SDKBase; @@ -14,6 +15,7 @@ public class PropertyTest : UdonSharpBehaviour public string MyStrProperty => "Test " + 1; + [PublicAPI] public int MyIntProperty { get; set; } float backingFloat;