For example Iām grabbing a Drag Controls component that gets added by Drop Listener and want to remove it
by user 103054507105067008
For example Iām grabbing a Drag Controls component that gets added by Drop Listener and want to remove it
by user 103054507105067008
either this.destroy() on the component (or theComponent.destroy()) or GameObject.destroy(theComponent)
If its networked use GameObject.destroySynced(...)
I tried this, it reports that console.log but the drag component still works in the scene
if(this.new != null)
{
//remove drag component
if (this.new.getComponent(DragControls))
{
//@ts-ignore
this.destroy(this.new.getComponent(DragControls));
console.log("destroeyd");
}
}
by user 103054507105067008
Ok that sounds like a bug - Iāll try in a minute
Any chance there is another DragControls component in the scene? When I destroy it here it stops working as expected
(tried destroying before awake, in awake, in start and onEndDrag and those all worked as expected
)
Ill try with the droplistener
Oh hey looking at your code: you need to call this.new.getComponent(DragControls).destroy()
Currently you destroy whatever component is running this code
aha, Iāll try that
by user 103054507105067008
That works
by user 103054507105067008