More seriously, F# is better at certain things, C# is better at different things.
I happen to love F#, and prefer it to C# for logic.
What I gain with F#
It forces me to expel nulls from my logic
It is easier for me to refactor and test
Combining/Dealing with functions is much easier
Deferred Execution of functions
Easy Caching for pure functions (Memoization)
Seriously for caching I add 1 line of code and it’s done
Overall, I’m not very good with F# yet. But these things are what drew me in. Other features of functional programming while nice, didn’t entice me away from C# which I’ve been using since v1, but these things are why I love it.
Progress Info: submitted V1.1 the other day. It will contain a simple Arkanoid game example written in F#.
Not really. Might be possible, but I am not really interested in that feature. F# kit is supposed to be as close to native F# support in Unity as possible, and nothing fancy.
Do you mean for the F# script files? I haven’t tried that in F#, but in C# the build order doesn’t matter, all scripts can reference each other. My guess is that it’s the same in F#.
From your screenshot, seems like you need to install Mono and Xamarin Studio – does doing so affect Unity’s native C# support at all? Love to try this but want to make sure F# scripts and associated Mono/Xamarin support needed for them are isolated – i.e. won’t screw up or affect in any way existing/normal C# stuff
You are welcome. You can try it already, it’s released for a few days now.
You install them separately. Unity’s stuff is not touched at all. Some day Unity will probably ship with Xamarin, so then those extra tools won’t be needed anymore.
Progress Info: working on more F# examples for the project. V1.2 will have a few functional programming functions. It’s amazing that this stuff runs in Unity now.
C# and F# are different in that regard. In F# the build order matters because it’s a 1 pass compile as opposed to the multipass that C# does. So things later in the file/build process are completely unknown. The project file for an F# project it primarily for defining the build order of the files.
In my F# solutions I have to keep the files in order, or it won’t build. However, depending on how you use it it might not be an issue. The example you gave, for instance, does reference anything from another file so it would be fine. In general it might not be a large issue. I’d just be worried because I keep building modules them composing them to build the “Engine”.
Can you give me a simple example that causes this error? Then I can try it with F# kit. I do throw all script file names into an xml file before compiling, so perhaps modifying that order solves it.
Hello! I can not create f# file. unity version: 5.4
when click: create => f# script.
result: nothing/empty.
no error, no message
p.s i import f# kit in root of folder Assets
Hey,
which operating system do you use? And can you take a look at the Editor folder and FSharpBuildWindows/OSX and see if the paths in the code match the paths on your computer. If not, which paths are different?
os : windows 10.
on my computer all paths in script FSharpBuildWindows - correct.
i reimport asset.
now, i when click: create => f# script
result: NewBehaviourScript.fs appear in root folder.
this script i can attach to gameobject in scene and when i modify this script - success too.
but!
when i rename this script i can not attach script to gameobject in scene.
screenshot: (after drag script to folder F#Out and rename from NewBehaviourScript to test)
Sounds good. Yes, the class name and the file name need to be identical to be able to add it to GameObjects. So if you want to rename it to test, you also have to open test.fs and rename the class to test.