- Home /
Enabling component - Please help
Hi,
I am trying to implement Multiplayer to my game and I need help with one script. I am using this Photon script:
void OnJoinedRoom()
{
GameObject monster = PhotonNetwork.Instantiate("monsterprefab", Vector3.zero, Quaternion.identity, 0);
CharacterControl controller = monster.GetComponent<CharacterControl>();
controller.enabled = true;
CharacterCamera camera = monster.GetComponent<CharacterCamera>();
camera.enabled = true;
}
The problem is that I have a space ship and thats not using the Character controller. How I can enable/disable some script attached to it ? Actually I am using my SpaceShipControls script and Rigidbody component. Please help how to write it in the script.
Did you even try before asking? I'm guessing you did not, and that's how you got 2 downvotes already...
Answer by Kiloblargh · Feb 06, 2014 at 09:15 PM
Scripts are components, so "`GetComponent.().enabled`" should work.
Your answer
Follow this Question
Related Questions
Close room on host exit 0 Answers
How to use Hashtables? 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Enable/Disable shader on script 2 Answers
Enter Trigger and Rigidbody Enable 1 Answer