Skip to content

Instantly share code, notes, and snippets.

@ApprenticeGC
Created October 27, 2012 09:18
Show Gist options
  • Save ApprenticeGC/3963720 to your computer and use it in GitHub Desktop.
Save ApprenticeGC/3963720 to your computer and use it in GitHub Desktop.
Unity 3d editor plugin code in F#
namespace Assembly_FSharp_vs
open UnityEditor
open UnityEngine
type public SomeTool() =
inherit UnityEditor.EditorWindow()
//
[<MenuItem("MySelection/Print Selection")>]
static member ShowWindow() = UnityEditor.EditorWindow.GetWindow(typeof<SomeTool>)
//
member this.OnGUI() =
if GUILayout.Button("Button") then this.Initialize()
//
member public this.Initialize() =
let selectedObjects = Selection.objects
for _ in selectedObjects do
Debug.Log("some object")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment