how to access a script with c# ?

in javascript i could do:

GameObject go2nd ;
go2nd = GameObject.Find( “2ndlaunch” ) ;
Component co = go2nd.GetComponent( “thescript”) ;
co.showme() ;

but in c# i get the error
“component does not contain a definition for showme()”

in my c# script i have:
public class thescript : MonoBehaviour {

public void showme( )
{
active = true ;
}
…}
( not sure if the public is needed actually )

Patricia.

Try declaring co as type thescript, instead of Component.

Thanks so much! it works beautifully.

I’m starting to like c# ( only 1 day i’ve been practicing it! )
Since i switched to c# for most of my scripts i have less variations between the in editor and release mode of my game. Definitely worth the switch.

Patricia.

No problem!

I feel the same way about C# :slight_smile:

Welcome to the C#-lovers club, drinks all around!

:wink:
-Jeremy