{"id":21272738,"url":"https://github.com/gilzoide/unity-fsharp","last_synced_at":"2025-04-14T11:13:11.167Z","repository":{"id":263883181,"uuid":"891649736","full_name":"gilzoide/unity-fsharp","owner":"gilzoide","description":"F# scripting in Unity with automatic compilation","archived":false,"fork":false,"pushed_at":"2024-11-24T22:14:19.000Z","size":1236,"stargazers_count":31,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-17T01:38:54.960Z","etag":null,"topics":["dotnet","fsharp","openupm","unity","unity-package","unity-plugin","unity3d","upm","upm-package"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gilzoide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["gilzoide"],"patreon":null,"open_collective":null,"ko_fi":"gilzoide","tidelift":null,"community_bridge":null,"liberapay":"gilzoide","issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2024-11-20T17:52:40.000Z","updated_at":"2025-01-16T21:12:40.000Z","dependencies_parsed_at":"2024-11-20T20:26:31.093Z","dependency_job_id":"7635a268-8ab4-433a-a0dc-3b981aefc0fd","html_url":"https://github.com/gilzoide/unity-fsharp","commit_stats":null,"previous_names":["gilzoide/unity-fsharp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-fsharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-fsharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-fsharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-fsharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gilzoide","download_url":"https://codeload.github.com/gilzoide/unity-fsharp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235053806,"owners_count":18928440,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet","fsharp","openupm","unity","unity-package","unity-plugin","unity3d","upm","upm-package"],"created_at":"2024-11-21T09:08:55.500Z","updated_at":"2025-01-22T02:47:26.335Z","avatar_url":"https://github.com/gilzoide.png","language":"C#","funding_links":["https://github.com/sponsors/gilzoide","https://ko-fi.com/gilzoide","https://liberapay.com/gilzoide"],"categories":[],"sub_categories":[],"readme":"# F# for Unity\nExperimental support for F# scripting in Unity: create F# scripts with the `.fs` file extension and they'll be built automatically using the [.NET SDK](https://dotnet.microsoft.com/).\n\n\n## Features\n- Automatically installs the [.NET SDK](https://dotnet.microsoft.com/) locally inside your `Library` folder\n- Automatically compiles F# scripts (`.fs` files) to a DLL usable by Unity\n  + The DLL and its dependencies are generated at `Assets/FSharpOutput`.\n    Consider ignoring this folder in your VCS (e.g.: adding to `.gitignore` file in Git repos).\n  + The DLL references the same DLLs as `Assembly-CSharp` does.\n  + Scripts inside `Editor` folders are only available in the Unity editor\n- Supports defining script compilation order in the `Assets/Editor/FSharpSettings` asset\n- Supports defining package references in the `Assets/Editor/FSharpSettings` asset\n- Uses the same [scripting symbols](https://docs.unity3d.com/Manual/scripting-symbol-reference.html) as C#, e.g. `UNITY_EDITOR`, `UNITY_STANDALONE`, `DEVELOPMENT_BUILD`, etc...\n- `MonoBehaviour`/`ScriptableObject` class names do not need to have the same name as their source files.\n  You can also declare several of them in a single file.\n- The F# project is added to the solution file generated by Unity, so that Intellisense works in IDEs (tested on Visual Studio Code with Ionide extension)\n\n\n## How to install\nEither:\n- Use the [openupm registry](https://openupm.com/) and install this package using the [openupm-cli](https://github.com/openupm/openupm-cli):\n  ```\n  openupm add com.gilzoide.fsharp\n  ```\n- Install using the [Unity Package Manager](https://docs.unity3d.com/Manual/upm-ui-giturl.html) with the following URL:\n  ```\n  https://github.com/gilzoide/unity-fsharp.git#1.0.0-preview3\n  ```\n- Clone this repository or download a snapshot of it directly inside your project's `Assets` or `Packages` folder.\n\n\n## Creating scripts in F#\n```fs\n// 1. Add a namespace to your file\nnamespace MyFSharpNamespace\n\n// 2. Import the UnityEngine and other namespaces as necessary\nopen UnityEngine\n\n// 3. Create classes that inherit from MonoBehaviour, as usual\ntype MyFSharpComponent() =\n  inherit MonoBehaviour()\n\n  // Use mutable serialized fields to edit them in the Inspector\n  [\u003cSerializeField\u003e]\n  let mutable serializedFloat = 5f\n\n  [\u003cSerializeField\u003e]\n  let mutable prefab: GameObject = null\n\n  [\u003cSerializeField\u003e]\n  let mutable intArray: array\u003cint\u003e = [||]\n\n  // In F#, lists are immutable by default and not serialized by Unity\n  // Use ResizeArray (a.k.a. System.Collections.Generic.List) to serialize lists\n  [\u003cSerializeField\u003e]\n  let mutable intList = new ResizeArray\u003cint\u003e()\n\n  // Declare member functions (a.k.a. methods)\n  member this.Start() =\n    // In F#, we mutate fields with `\u003c-` instead of `=`\n    serializedFloat \u003c- 10f\n\n    // In F#, use `isNull` and `isNotNull` to check for null Objects\n    if isNotNull prefab then\n      Object.Instantiate(prefab, this.transform) |\u003e ignore\n```\n\n\n## F# Settings asset\nThe asset `Assets/Editor/FSharpSettings.asset` is created automatically and contains the following settings:\n- `Script Compile Order`: this list contains all F# script assets that will be compiled.\n  Freely reorder the scripts to ensure the correct compilation order in the F# project.\n  Tip: keep `FSharpGlobals.fs` first.\n- `Package References`: add NuGet package references to the F# project.\n  The package DLLs will be automatically copied to the `Assets/FSharpOutput` directory by the build.\n\n\u003cimg src=\"Extras~/FSharpSettings.png\" width=\"400\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilzoide%2Funity-fsharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilzoide%2Funity-fsharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilzoide%2Funity-fsharp/lists"}