I was not sure where to post this thread, scripting, support or wish list? Still do not know. Let's try it here.
I love Lisp and Scheme. Of course I know that C# is good language, but Scheme is what I really like. The first thing I want to know about any game engine is, "How can it be used with Scheme?"
The first place where I checked for Unity is this forum. Result: almost nothing apropos. Then this page. And I think this interface is not useful for Scheme/Lisp implementations based on C or C++, because "Calling C# / JavaScript back from native code" will be slow. That is very bad because it limits scriptability to only infrequent high-level control. The ideal solution would be a fast interface, so a C-based Scheme like Gambit-C could be used for low-level operations like animation stacking, game object state controls, and so on.
My next step was to check around for Scheme implementations on Mono. In my opinion, there is no perfect project for Mono yet. The IronScheme and Clojure NET looks most interesting. There are other Mono/CLR Scheme and Lisp implementations but IronScheme looks most usable right now.
After some experiments I figured out that to get IronScheme I must compile it on my machine, which I did with MSVC. Then I copied IronScheme files to the Assets folder.
Code:
ironscheme.boot.dll IronScheme.Closures.dll IronScheme.dll Microsoft.Scripting.dll Oyster.IntX.dllSo my final structure isCode:
Also folders IronScheme/lib IronScheme/ironscheme
Inside the Unity editor scheme REPL works nice. There are big problems though with the Unity build pipeline and file processing. Specifically:Code:
Assets/Plugins/Scheme/[lib|ironscheme] Assets/Plugins/Scheme/[ironscheme.boot.dll|IronScheme.Closures.dll|IronScheme.dll|Microsoft.Scripting.dll|Oyster.IntX.dll]
1) How I can a new file type to the Project Manager? For example I want to register SchemeScript type and see it included in the context menu Create option.
2) How I can tell to Unity to process some particular file type (for example .sls) with an external tool like a Scheme compiler or C# custom preprocessor? How I can control when this processing happens: before C# compiler or after?
3) How I can tell Unity that this file must be re-processed when it has changed?
4) How I can tell Unity that some files (Scheme libraries, other data files) should be copied to some designated target during the application build?
5) How I can tell Unity to different file types with specific editors when clicked on?
6) How add "preview content of file" feature for custom file types when they are selected in the project manager?
At this point, I have made a few experiments with some simple GUI projects using IronScheme in Unity. These projects run OK in Unity, but fail to run when published as standalone applications.
P.S. Attachment has a UnityPackage with my project. You can try enter the next sequences in the Scheme console
For simple Math
For function definitionCode:
> (+ 1 2) 3
Just a closure exampleCode:
> (define (foo n) (* n n)) #<unspecified> > (foo 5) 25
Access to the Unity's Transform and Vector3Code:
> (define (foo n) (lambda (m) (set! n (+ n m)) n)) #<unspecified> > (define bar (foo 10)) #<unspecified> > (bar 1) 11 > (bar 1) 12 > (bar 19) 22
Code:
> (clr-call Transform Translate (clr-prop-get MonoBehaviour transform 'this) (clr-new Vector3 100 100 100)) #<unspecified>
Load external script file. Make fib.ss in the Assets folder
Then inside consoleCode:
(import (rnrs)) (define (fib n) (if (< n 2) n (+ (fib (- n 2)) (fib (- n 1)))))
Code:
(include "Assets/fib.scm") (fib 10)

Reply With Quote