Hey peeps, got a question here related to hooks. I am using Arcadia 1.0.14, Unity2018.4.14f1 (free edition) I got pretty much stuck, and getting exceptions in the console
(defn happy-logger [&_ ] (log "heelo")) (hook+ (object-named "Cube1") :update :move-fast #'game.core/happy-logger)
When I run, I got the exception
ArityException: Wrong number of args (2) passed to: Unbound: #'game.core/happy-logger clojure.lang.AFn.invoke (System.Object arg1, System.Object arg2) (at <fb1204dbf0b848beaab1559f81f1b22c>:0) ArcadiaBehaviour.RunFunctions () (at Assets/Arcadia/Components/ArcadiaBehaviour.cs:500) UpdateHook.Update () (at Assets/Arcadia/Components/UpdateHook.cs:9) Context: key: :orbit; fn: #'game.core/happy-logger; GameObject: Cube; GameObject id: -59878 UnityEngine.Debug:LogError(Object, Object) ArcadiaBehaviour:PrintContext(Int32) (at Assets/Arcadia/Components/ArcadiaBehaviour.cs:480) ArcadiaBehaviour:RunFunctions() (at Assets/Arcadia/Components/ArcadiaBehaviour.cs:499) UpdateHook:Update() (at Assets/Arcadia/Components/UpdateHook.cs:9)
Anybody has an idea why this is happening ?
game.core/happy-loggerexisting. you excluded the namespace in your code, but I assume it's
game.core? :) next I'm unsure if
[&_ ]actually works, might be that you're getting a compiler error earlier? you should change that to
[& _]either way :)
#'game.core/happy-loggerisn't bound to anything
Another hint on that ArityException: Wrong number of args (2) passed to: Unbound: #'game.core issue, in case it helps anyone
(object-named "x") (def test (object-named "x"))
I have a bad habit of writing test definitions and finders like object-named in the same file as my hook functions. Just random things I'll execute and then keep modifying to see what answers it pretty prints before I wrap it properly like the tutorial says. I've been using Arcadia for a couple of months now without issue, but the past couple of days none of my hooks have been working with the error the others have had.
I found that this is because in my new file I had been writing these "test" finders ABOVE my hooks instead of below. It's a dumb mistake on my part to leave dead code in the file while it's running, but I just wanted to give people the heads up in case they're as confused as I was if everything stopped working all of a sudden. Arcadia/Unity stops reading entirely once it finds out that you've used a "finder" function outside of a starter hook - don't leave them lying around like I do or nothing else will run.