Enabling/disabling a component.

Hi, i am working on iPhone game and i have to enable/disable the components. i am using this but when i click the build button it gives me error.

GetComponent("NetworkRigidbody").enabled = false;

and this is the error i get.

Error building Player because scripts had compiler errors
UnityEditor.HostView:OnGUI()

its working for webplayer but not for the iphone.

thanks in advance for any help.

Hi

I hope , the solution of your problem should be…

GetComponent < T >().enabled = false;

where T  will be component's name which is attached of this game object. Like :

GetComponent < NetworkRigidbody >().enabled = false; < T >

Regards

Laksh

Hi.
I guess the plblem of sample below.
http://unity3d.com/support/resources/example-projects/networking-example.html

I moved NetworkRigidbody to “Plugins” folder I created.
And, I fix it like this

(GetComponent("NetworkRigidbody") as NetworkRigidbody).enabled = false;