Log in or register to post comments

Delete Image Target Behaviour on Unity

October 6, 2014 - 3:57pm #1
I have a `GameObject` that has a script called `AristaImageTarget` which implements the `ITrackableEventHandler` interface and contains a reference to an `ImageTargetBehaviour` which is a child it. The problem is that every time I delete `AristaImageTarget` I get this error
    MissingReferenceException: The object of type 'ImageTargetBehaviour' has been destroyed but you are still trying to access it.
and the culprid seems to be the `ARCamera` according the console when I click on the error. So I decided to do this on `OnDestroy` on `AristaImageTarget`
    trackable.UnregisterTrackableEventHandler (this);
    Destroy (trackable);
Where `trackable` is the reference to the `ImageTargetBehaviour`. But I still get the error :(
Log in or register to post comments