forked from MerlinVR/UdonSharp
-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug in detail:
All optional arguments after the first optional argument that defaults appear to also default, even if they are given a value when calling.
Provide steps/code to reproduce the bug:
Steps or code to reproduce the behavior.
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class OptionalTest : UdonSharpBehaviour
{
void optionalArg(string str, int check = 0) {
Debug.Log($"Optional arg test! Optional ver: str {str} int {check}");
}
void moreOptionalArg(string str, int check = 0, int doubleCheck = 0, float evenMoreNum = 0f) {
Debug.Log($"Optional arg test! Required ver: str {str} int: {check} doubleCheck: {doubleCheck}, evenMore: {evenMoreNum}");
}
void requiredArg(string str, int check) {
Debug.Log($"Optional arg test! Required ver: str {str} int {check}");
}
void Start()
{
Debug.Log("Optional arg test! START");
optionalArg("optional1", check: 25);
requiredArg("required2", 17);
moreOptionalArg("maybeBroken", doubleCheck: 69);
moreOptionalArg("idk Anymore", check: -5, doubleCheck: -8);
moreOptionalArg("maybeJustFirst?", check: 69);
moreOptionalArg("even MORE testing", check: 8, evenMoreNum: 8.4f);
}
}
Log as text:
Optional arg test! START
Optional arg test! Optional ver: str optional1 int 25
Optional arg test! Required ver: str required2 int 17
Optional arg test! Required ver: str maybeBroken int: 0 doubleCheck: 0, evenMore: 0 (doubleCheck should be 69)
Optional arg test! Required ver: str idk Anymore int: -5 doubleCheck: -8, evenMore: 0 (correct)
Optional arg test! Required ver: str maybeJustFirst? int: 69 doubleCheck: 0, evenMore: 0 (correct)
Optional arg test! Required ver: str even MORE testing int: 8 doubleCheck: 0, evenMore: 0 (evenMore is missing)
Expected behavior:
Optional arg test! START
Optional arg test! Optional ver: str optional1 int 25
Optional arg test! Required ver: str required2 int 17
Optional arg test! Required ver: str maybeBroken int: 0 doubleCheck: 69, evenMore: 0
Optional arg test! Required ver: str idk Anymore int: -5 doubleCheck: -8, evenMore: 0
Optional arg test! Required ver: str maybeJustFirst? int: 69 doubleCheck: 0, evenMore: 0
Optional arg test! Required ver: str even MORE testing int: 8 doubleCheck: 0, evenMore: 8.4
Additional Information:
Environment:
Script was placed on an empty object in the root of the hierarchy.
Package Versions: (Latest as of making bug report)
VRC SDK - Worlds: 3.7.1
VRC Package resolver tool: 0.1.29
VRC SKD - Base: 3.7.1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
