Attaching a collider script to an object instatiated during play

Hi all,

I have a ball prefab that has a sphere collider and a rigibody attached to it
i have a platform that has a box collider attached to it

in the launcher script, i instantiated the prefab to get a game object
in the same script, i added the onCollisionEnter() function

but the function is never called, shall i attached it to the gameobject in any way?

any tip mostly welcomed

the onCollisionEnter function should be on a script attached to the object that has the collider on it
if you need to do that dynamically try making a script like
CollisionScript.js
and in it put

function onCollisionEnter(collision : Collision) {
print("hello");
}

then you can say to your instantiated prefab (which has the collider on it)

prefab.AddComponent(CollisionScript);
//or
prefab.AddComponent("CollisionScript");

it works thanks