Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SemanticViolationException: No matching override for Button #4

Open
friuns2 opened this issue Nov 16, 2021 · 6 comments
Open

SemanticViolationException: No matching override for Button #4

friuns2 opened this issue Nov 16, 2021 · 6 comments

Comments

@friuns2
Copy link
Contributor

friuns2 commented Nov 16, 2021

Hi i'm working on modding tool using slowsharp https://github.com/friuns2/LuaMod/tree/SharpMod

if i type GUILayout.Button("test"); it throws exception, can you help?

SemanticViolationException: No matching override for `Button`
Slowsharp.Runner.RunInvocation (Microsoft.CodeAnalysis.CSharp.Syntax.InvocationExpressionSyntax node) (at <2cd81ad168544a2391dd8ded9b2f4f87>:0)
Slowsharp.Runner.RunExpression (Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax node) (at <2cd81ad168544a2391dd8ded9b2f4f87>:0)
Slowsharp.Runner.RunIf (Microsoft.CodeAnalysis.CSharp.Syntax.IfStatementSyntax node) (at <2cd81ad168544a2391dd8ded9b2f4f87>:0)
Slowsharp.Runner.RunAsExecution (Microsoft.CodeAnalysis.SyntaxNode node) (at <2cd81ad168544a2391dd8ded9b2f4f87>:0)
Slowsharp.Runner.Run (Microsoft.CodeAnalysis.SyntaxNode node) (at <2cd81ad168544a2391dd8ded9b2f4f87>:0)
Slowsharp.Runner.RunBlock (Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax node, Slowsharp.VarFrame vf, System.Int32 pc) (at <2cd81ad168544a2391dd8ded9b2f4f87>:0)
Slowsharp.Runner.RunMethod (Slowsharp.SSMethodInfo method, Slowsharp.HybInstance[] args) (at <2cd81ad168544a2391dd8ded9b2f4f87>:0)
Slowsharp.Runner.RunMethod (Slowsharp.HybInstance _this, Slowsharp.SSMethodInfo method, Slowsharp.HybInstance[] args) (at <2cd81ad168544a2391dd8ded9b2f4f87>:0)
Slowsharp.Invokable.Invoke (Slowsharp.HybInstance _this, Slowsharp.HybInstance[] args, System.Boolean hasRefOrOut) (at <2cd81ad168544a2391dd8ded9b2f4f87>:0)
Slowsharp.SSMethodInfo.Invoke (Slowsharp.HybInstance _this, Slowsharp.HybInstance[] args) (at <2cd81ad168544a2391dd8ded9b2f4f87>:0)
MethodPool.Execute1 () (at Assets/Scripts/SharpMod/MethodPool.cs:34)
@friuns2
Copy link
Contributor Author

friuns2 commented Nov 17, 2021

CScript.Run("using UnityEngine; class Test{ void Main(){GUILayout.Button(\"test\")}}");

ah looks like it cannot handle params 

public static bool Button(string text, params GUILayoutOption[] options)

@pjc0247
Copy link
Owner

pjc0247 commented Nov 19, 2021

Sorry for inconvenience. SlowSharp does not support full C# syntax.
seems like there are missing implementation of params as you said.

https://github.com/Ourpalm/ILRuntime

what about take a look of this project. it's actively maintained til now.

@friuns2
Copy link
Contributor Author

friuns2 commented Nov 22, 2021

Thanks i know about it, but it cant compile c# code at runtime. I'm very happy with this project so far works flowlesly :)

@pjc0247
Copy link
Owner

pjc0247 commented Nov 22, 2021

@friuns2
you can execute .cs file using ILRuntime.
https://stackoverflow.com/questions/32769630/how-to-compile-a-c-sharp-file-with-roslyn-programmatically
.cs -> roslyn -> .dll -> ILRuntime.

or you may want to take a look this asset
https://assetstore.unity.com/packages/tools/cs-script-for-unity-23510
(can execute 100% of C# syntax. the only problem is JIT based scripting engine won't work on iOS or WebAssembly)

@friuns2
Copy link
Contributor Author

friuns2 commented Nov 22, 2021

I'm building for android and it need il2cpp for 64bit

.cs -> roslyn -> .dll -> ILRuntime.

That could work but have to copy all dlls to project resources

@friuns2
Copy link
Contributor Author

friuns2 commented Dec 1, 2021

also in ILRuntime is no easy way to override class, have to create Adaptor, but your CScript.Override works without any additional code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants