Skip to main content

Unexpected token name or expected punc error in Unity Playworks Plugin window

SyntaxError: Unexpected token name «shaft», expected punc «,»
UnityEngine.Debug:LogError (object,UnityEngine.Object)
.: (object,Luna.Unity.EditorScripts.Logging.LogLevel,object)
.:(object,object)
./:(object,System.Diagnostics.DataReceivedEventArgs)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

This could be due to bridge.net not being able to compile the use of inline out parameters in C#.

For example:

if (int.TryParse(value, out int i) {...}

Possible solution:

  • Declare the out parameter above the if statement instead. For example:

    if (int.TryParse(value, out i) {...}

    More details of the inline out parameter can be found here on the MS Docs site.