Amir Ibnu Alfian
Amir Ibnu Alfian

Reputation: 3

how to setactive/Destroy video background and video source artoolkit in unity

When i'm want destroy or setactive gameobject video background and video source from code Artoolkit Controll didn't Destroy or dispose;

public GameObject Artoolkit;

void Update()
{
if(GetKeyDown(Key.A))
{
Destroy(Artoolkit);
//or Artoolkit.SetActive(false);
}
} 

This My Image, can't destroy video background and video source artoolkit in unity

Upvotes: 0

Views: 121

Answers (1)

bleater
bleater

Reputation: 5499

The video source and video background GameObjects are created by ARToolKit for Unity on start, and are destroyed when it stops. The correct way to remove them from the scene is to call ARController.StopAR().

If you make the ARController inactive and then destroy the objects yourself, you will likely receive invalid object reference errors when you make the ARController active again, since it holds references to these objects which it expects to be valid.

Upvotes: 0

Related Questions