Skip to content

Instantly share code, notes, and snippets.

@nasser
Created October 24, 2014 16:37
Show Gist options
  • Save nasser/3984fe7dd25983367bb0 to your computer and use it in GitHub Desktop.
Save nasser/3984fe7dd25983367bb0 to your computer and use it in GitHub Desktop.
(ns hooks
(:use arcadia.core))
(defmacro invoke-if-bound [sym]
`(if-let [~sym ((ns-map '~'user) '~sym)]
(~sym)))
; via jplur_ ;)
(defcomponent Hooks []
(Start [this]
(ns user)
(require 'user)
(invoke-if-bound setup))
(LateUpdate [this]
(invoke-if-bound late-update))
(FixedUpdate [this]
(invoke-if-bound fixed-update))
(Update [this]
(invoke-if-bound update))
(OnGUI [this]
(invoke-if-bound gui))
(OnDrawGizmos [this]
(invoke-if-bound gizmos))
(OnDrawGizmosSelected [this]
(invoke-if-bound gizmos-selected)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment