# Script Component not Being detected by Vuforia's Default Trackable Event Handler Script

I have a Script Component named Start inside a GameObject named StartSpawn and I am trying to run a function from Start when the target is found but Unity/Visual Studio is not detecting the Start script component. I even tried restarting both Unity and Visual Studio to only worsen the problem. When I opened both programs again and inspecting the code, the code I added was deleted and the script DefaultTrackableEventHandler.cs was back to its original code. Btw, the function I'm calling to Instantiates a Prefab.

Here's the code inside the DefaultTrackableEventHandler.cs:

protected virtual void OnTrackingFound()
{
if (mTrackableBehaviour)
{
var rendererComponents = mTrackableBehaviour.GetComponentsInChildren<Renderer>(true);
var colliderComponents = mTrackableBehaviour.GetComponentsInChildren<Collider>(true);
var canvasComponents = mTrackableBehaviour.GetComponentsInChildren<Canvas>(true);
//test
Start summoner = GetComponentInChildren<Start>();

// Enable rendering:
foreach (var component in rendererComponents)
component.enabled = true;

// Enable colliders:
foreach (var component in colliderComponents)
component.enabled = true;

// Enable canvas':
foreach (var component in canvasComponents)
component.enabled = true;

//test spawn
summoner.OnAppear();
}
}


For Vuforia, I am giving few tricks to you for instantiate object:

1. make a script CustomTrackableEventHandler.cs
2. add on image target in place of DefaultTrackableEventHandler.
3. copy code from DefaultTrackableEventHandler to CustomTrackableEventHandler.
4. add variable public Gameobject prefab;
5. add function in OnTrackingFound() and OnTrackingLost() as per this:

public void InstantiateObject(){
Instantiate(prefab, new Vector3(0, 0, 0), Quaternion.identity);
}

public void DestroyObject(){
Destroy(this.gameobject);
}


This is just basic logic; if you want to learn advanced logic, let me know and I will help you.