Skip to main content

Unexpected token name or expected punc error in Luna plugin window

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

This could be due to 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.