Skip to content

Instantly share code, notes, and snippets.

@nasser
Created May 14, 2014 14:33
Show Gist options
  • Save nasser/91aa3c392666d32fc1bf to your computer and use it in GitHub Desktop.
Save nasser/91aa3c392666d32fc1bf to your computer and use it in GitHub Desktop.
(ns PlainClojureShit
(:import
(UnityEngine Debug)
(UnityEditor EditorGUILayout)))
(def happy (atom true)) ;; Multiple instances of this component will SHARE this atom! They should each have their OWN atom!
(defn start [this]
(Debug/Log "PlainClojureShit is starting"))
(defn update [this]
(Debug/Log (str "happy is " @happy)))
(defn on-mouse-down [this]
(reset! happy (not @happy)))
(defn on-inspector-gui [this]
(Debug/Log (str "on-inspector-gui " @happy))
(let [gui-happy (EditorGUILayout/Toggle "Happy?" @happy nil)]
(if (not= gui-happy happy)
(do
(reset! happy gui-happy)
true)
false)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment