Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing a component is not finished after a call to cmpt- #381

Open
kamisori opened this issue Mar 31, 2020 · 1 comment
Open

Removing a component is not finished after a call to cmpt- #381

kamisori opened this issue Mar 31, 2020 · 1 comment

Comments

@kamisori
Copy link

Windows 10, Unity 2019.3.5f1, Arcadia 268bed0

Given the following code:

(ns user
  (:use arcadia.core)
  (:import [UnityEngine BoxCollider2D
                        Debug
                        GameObject
                        MeshCollider
                        Rigidbody2D
                        RigidbodyType2D]))

(defn init-player []
  (destroy (object-named "Player"))
  (cmpt- (create-primitive :quad "Player") MeshCollider)
  (let [player (object-named "Player")]
    (log (cmpt player MeshCollider))
    (cmpt+ player BoxCollider2D)
    (sets! (cmpt+ player Rigidbody2D)
            gravityScale (float 0.0)
            bodyType RigidbodyType2D/Dynamic)))

When calling init-player in the REPL, it responds with:

System.NullReferenceException: Object reference not set to an instance of an object
  clojure.lang.Reflector.SetInstanceFieldOrProperty (object, System.String, object)
* user/init-player
* user/eval
  clojure.lang.Compiler.eval (object)
* clojure/core/eval
* clojure.lang.Var
* Arcadia.NRepl+EvalFn coop/Assets/Arcadia/Editor/NRepl.cs (203:6)

The Unity Editor Console logs the still available MeshCollider:

Player (UnityEngine.MeshCollider)
UnityEngine.Debug:Log(Object)
arcadia$core$log__31902:invokeStatic(ISeq)
arcadia$core$log__31902:doInvoke(Object)
clojure.lang.RestFn:invoke(Object)
user$init_player__33499:invokeStatic()
user$init_player__33499:invoke()
user$eval__33508__33513:invokeStatic()
user$eval__33508__33513:invoke()
clojure.lang.Compiler:eval(Object)
clojure$core$eval__3112:invokeStatic(Object)
clojure$core$eval__3112:invoke(Object)
clojure.lang.Var:invoke(Object)
Arcadia.EvalFn:invoke() (at Assets/Arcadia/Editor/NRepl.cs:203)
arcadia$internal$callbacks$run_callbacks__28824:invokeStatic(Object, Object)
arcadia$internal$callbacks$run_callbacks__28824:invoke(Object, Object)
arcadia$internal$editor_callbacks$run_callbacks__28918:invokeStatic()
arcadia$internal$editor_callbacks$run_callbacks__28918:invoke()
clojure.lang.Var:invoke()
Arcadia.EditorCallbacks:RunCallbacks() (at Assets/Arcadia/Editor/EditorCallbacks.cs:24)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

then complains about me adding a BoxCollider2D to a GO with a MeshCollider:

Can't add component 'BoxCollider2D' to Player because it conflicts with the existing 'MeshCollider' derived component!
UnityEngine.GameObject:AddComponent(Type)
arcadia$core$cmpt_PLUS___32127:invokeStatic(Object, Object)
arcadia$core$cmpt_PLUS___32127:invoke(Object, Object)
user$init_player__33499:invokeStatic()
user$init_player__33499:invoke()
user$eval__33508__33513:invokeStatic()
user$eval__33508__33513:invoke()
clojure.lang.Compiler:eval(Object)
clojure$core$eval__3112:invokeStatic(Object)
clojure$core$eval__3112:invoke(Object)
clojure.lang.Var:invoke(Object)
Arcadia.EvalFn:invoke() (at Assets/Arcadia/Editor/NRepl.cs:203)
arcadia$internal$callbacks$run_callbacks__28824:invokeStatic(Object, Object)
arcadia$internal$callbacks$run_callbacks__28824:invoke(Object, Object)
arcadia$internal$editor_callbacks$run_callbacks__28918:invokeStatic()
arcadia$internal$editor_callbacks$run_callbacks__28918:invoke()
clojure.lang.Var:invoke()
Arcadia.EditorCallbacks:RunCallbacks() (at Assets/Arcadia/Editor/EditorCallbacks.cs:24)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

same with the RigidBody2D:

Can't add component 'Rigidbody2D' to Player because it conflicts with the existing 'MeshCollider' derived component!
UnityEngine.GameObject:AddComponent(Type)
arcadia$core$cmpt_PLUS___32127:invokeStatic(Object, Object)
arcadia$core$cmpt_PLUS___32127:invoke(Object, Object)
user$init_player__33499:invokeStatic()
user$init_player__33499:invoke()
user$eval__33508__33513:invokeStatic()
user$eval__33508__33513:invoke()
clojure.lang.Compiler:eval(Object)
clojure$core$eval__3112:invokeStatic(Object)
clojure$core$eval__3112:invoke(Object)
clojure.lang.Var:invoke(Object)
Arcadia.EvalFn:invoke() (at Assets/Arcadia/Editor/NRepl.cs:203)
arcadia$internal$callbacks$run_callbacks__28824:invokeStatic(Object, Object)
arcadia$internal$callbacks$run_callbacks__28824:invoke(Object, Object)
arcadia$internal$editor_callbacks$run_callbacks__28918:invokeStatic()
arcadia$internal$editor_callbacks$run_callbacks__28918:invoke()
clojure.lang.Var:invoke()
Arcadia.EditorCallbacks:RunCallbacks() (at Assets/Arcadia/Editor/EditorCallbacks.cs:24)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

and finally: because the RigidBody2D couldn't be added I'm trying to sets! a nil:

NullReferenceException: Object reference not set to an instance of an object
clojure.lang.Reflector.SetInstanceFieldOrProperty (System.Object target, System.String fieldName, System.Object val) (at <fb1204dbf0b848beaab1559f81f1b22c>:0)
user$init_player__33499.invokeStatic () (at <8bf3ff39d57c4f4382aba633b972f7c0>:0)
user$init_player__33499.invoke () (at <8bf3ff39d57c4f4382aba633b972f7c0>:0)
user$eval__33508__33513.invokeStatic () (at <8bf3ff39d57c4f4382aba633b972f7c0>:0)
user$eval__33508__33513.invoke () (at <8bf3ff39d57c4f4382aba633b972f7c0>:0)
clojure.lang.Compiler.eval (System.Object form) (at <fb1204dbf0b848beaab1559f81f1b22c>:0)
clojure$core$eval__3112.invokeStatic (System.Object ) (at <8bf3ff39d57c4f4382aba633b972f7c0>:0)
clojure$core$eval__3112.invoke (System.Object ) (at <8bf3ff39d57c4f4382aba633b972f7c0>:0)
clojure.lang.Var.invoke (System.Object arg1) (at <fb1204dbf0b848beaab1559f81f1b22c>:0)
Arcadia.NRepl+EvalFn.invoke () (at Assets/Arcadia/Editor/NRepl.cs:256)
arcadia$internal$callbacks$run_callbacks__28824.invokeStatic (System.Object , System.Object ) (at <8bf3ff39d57c4f4382aba633b972f7c0>:0)
arcadia$internal$callbacks$run_callbacks__28824.invoke (System.Object , System.Object ) (at <8bf3ff39d57c4f4382aba633b972f7c0>:0)
arcadia$internal$editor_callbacks$run_callbacks__28918.invokeStatic () (at <8bf3ff39d57c4f4382aba633b972f7c0>:0)
arcadia$internal$editor_callbacks$run_callbacks__28918.invoke () (at <8bf3ff39d57c4f4382aba633b972f7c0>:0)
clojure.lang.Var.invoke () (at <fb1204dbf0b848beaab1559f81f1b22c>:0)
Arcadia.EditorCallbacks.RunCallbacks () (at Assets/Arcadia/Editor/EditorCallbacks.cs:24)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Delegate.DynamicInvokeImpl (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Delegate.DynamicInvoke (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <887a438259064e89922419bc7b8810ab>:0)
@timsgardner
Copy link
Contributor

Weird, I'll take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants