marijnz / unity-shell

Write and execute code in an intuitive "shell" with autocompletion, for the Unity Editor.
MIT License
453 stars 29 forks source link

UnityShell does not work with .NET 4.x Equivalent #4

Closed MetaflameDragon closed 6 years ago

MetaflameDragon commented 6 years ago

UnityShell (or rather the Evaluator class) does not work with the .NET 4.x Equivalent Player setting and throws NullReferenceExceptions everytime Evaluator.Run() or Evaluator.Compile() executes. Is there a way to fix this?

Full error: NullReferenceException: Object reference not set to an instance of an object Mono.CSharp.TypeManager.IsThisOrFriendAssembly (System.Reflection.Assembly assembly) (at <9e8e8af2775742419f160996c8a468b4>:0) Mono.CSharp.Namespace.RegisterExternalExtensionMethodClass (System.Type type) (at <9e8e8af2775742419f160996c8a468b4>:0) Mono.CSharp.RootNamespace.RegisterExtensionMethodClass (System.Type t) (at <9e8e8af2775742419f160996c8a468b4>:0) Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) (at <9e8e8af2775742419f160996c8a468b4>:0) Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) (at <9e8e8af2775742419f160996c8a468b4>:0) Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) (at <9e8e8af2775742419f160996c8a468b4>:0) Mono.CSharp.Driver.LoadReferences () (at <9e8e8af2775742419f160996c8a468b4>:0) Mono.CSharp.Evaluator.InitAndGetStartupFiles (System.String[] args) (at <9e8e8af2775742419f160996c8a468b4>:0) Mono.CSharp.Evaluator.Init (System.String[] args) (at <9e8e8af2775742419f160996c8a468b4>:0) Mono.CSharp.Evaluator.Init () (at <9e8e8af2775742419f160996c8a468b4>:0) Mono.CSharp.Evaluator.Run (System.String statement) (at <9e8e8af2775742419f160996c8a468b4>:0) UnityShell.ShellEvaluator..ctor () (at Assets/UnityShell/Editor/Scripts/ShellEvaluator.cs:24)

marijnz commented 6 years ago

Try again with the latest version, https://github.com/marijnz/unity-shell/pull/6 got merged. If it works, feel free to close this one 👍

MetaflameDragon commented 6 years ago

Thanks for the merge, it now works just fine!