<aside> ☝ For this scaffold to work as intended, it is recommended to set up the Logger
</aside>
from udon_classes import * # IGNORE_LINE
SystemVoid = SystemVoid # IGNORE_LINE # pylint: disable=undefined-variable
this_trans = this_trans # IGNORE_LINE # pylint: disable=undefined-variable
this_gameObj = this_gameObj # IGNORE_LINE # pylint: disable=undefined-variable
def initGraphVars() -> SystemVoid:
version = 1
graphName = "<GraphName>"
loggerObject = UnityEngineGameObject.Find("Logger")
hasLogger = SystemObject(loggerObject) != None
if hasLogger:
logger = VRCUdonCommonInterfacesIUdonEventReceiver(loggerObject).GetComponent("UdonBehaviour"))
# LOGGER SCAFFOLD
def logExternal(logInput: SystemObject) -> SystemVoid:
logger.SetProgramVariable("fromGraph", SystemObject(graphName))
logger.SetProgramVariable("toLog", logInput)
logger.SendCustomEvent("_log")
def logContexted(input: SystemObject) -> SystemVoid:
UnityEngineDebug.Log(SystemObject("[" + graphName + "]: " + SystemConvert.ToString(input)))
if hasLogger:
logExternal(input)
# PROGRAM
def _start():
initGraphVars()
logContexted(SystemObject("v " + SystemConvert.ToString(version)))
"Udon Scaffold": {
"scope": "python",
"prefix": "uscaffold",
"body": [
"from udon_classes import * # IGNORE_LINE",
"SystemVoid = SystemVoid # IGNORE_LINE # pylint: disable=undefined-variable",
"this_trans = this_trans # IGNORE_LINE # pylint: disable=undefined-variable",
"this_gameObj = this_gameObj # IGNORE_LINE # pylint: disable=undefined-variable",
"",
"def initGraphVars() -> SystemVoid:",
" version = 1",
" graphName = \\"$1\\"",
" loggerObject = UnityEngineGameObject.Find(\\"Logger\\")",
" hasLogger = SystemObject(loggerObject) != None",
" if hasLogger:",
" logger = VRCUdonCommonInterfacesIUdonEventReceiver(loggerObject).GetComponent(\\"UdonBehaviour\\"))",
"",
"# LOGGER SCAFFOLD",
"def logExternal(logInput: SystemObject) -> SystemVoid:",
" logger.SetProgramVariable(\\"fromGraph\\", SystemObject(graphName))",
" logger.SetProgramVariable(\\"toLog\\", logInput)",
" logger.SendCustomEvent(\\"_log\\")",
"",
"def logContexted(input: SystemObject) -> SystemVoid:",
" UnityEngineDebug.Log(SystemObject(\\"[\\" + graphName + \\"]: \\" + SystemConvert.ToString(input)))",
" if hasLogger:",
" logExternal(input)",
"",
"# PROGRAM",
"def _start():",
" initGraphVars()",
" logContexted(SystemObject(\\"v \\" + SystemConvert.ToString(version)))",
" "
]
},