- Home /
How do I make a callback run?
My code looks like this but the callback print never runs? I am using pragma Strict. AM I doing this right?
Any ideas?
DoAFunction( "Hello", DoACallback);
function DoAFunction( arg:String, callback:Function ) { callback(arg); }
function DoACallback( myString:String ) { print(myString);//NEVER PRINTS }
Comment
Answer by Bampf · Mar 22, 2011 at 10:59 AM
Works for me. Did you attach the script to an active GameObject in your scene?