Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Wololo Plays · Jun 20, 2014 at 04:11 PM · errormultiplayerplayer

Error in the script

My server script, is giving error. Please explain step by step, because I am new here.

I'm Brazilian

alt textalt text

 #pragma strict
 var Ip : String = "127.0.0.1";
 var Porta : String = "25000";
 var MaxPlayer : String = "2";
 var Senha : String;
 
 var Player : GameObject;
 function Start () {
 
 }
 
 function OnGUI () {
     GUILayout.BeginArea(Rect(Screen.width / 2 - 150,Screen.height / 2 - 200,300,400));
     if(Network.peerType == NetworkPeerType.Disconnected){
         GUILayout.Label("IP :");
         Ip = GUILayout.TextField(Ip);
         GUILayout.Label("Porta :");
         Porta = GUILayout.TextField(Porta);
         GUILayout.Label("Max Players :");
         MaxPlayer = GUILayout.TextField(MaxPlayer);
         GUILayout.Label("Senha :");
         Senha = GUILayout.TextField(Senha);
         if(GUILayout.Button("Criar Server")){
             Criar(int.Parse(Porta),int.Parse(MaxPlayer),Senha);
         }
         if(GUILayout.Button("Conectar Server")){
             Connect(Ip,int.Parse(Porta),Senha);
         }    
     }
     GUILayout.EndArea();
 }
 
 function Criar(port : int,max : int,senha : String){
     Network.incomingPassword = senha;
     Network.InitializeServer(max,port,false);
     OnConnectedToServer();
 }
 
 function Connect(ip : String,port : int,senha : String){
     Network.Connect(ip,port,senha);
 }
 
 function OnConnectedToServer(){
     Network.Instantiate(Player,Vector3.zero + Vector3(Random.Range(-2,2),0,0),Quaternion.identity,0);
 }
 function OnPlayerDisconnected(player : NetworkPlayer){
     Network.DestroyPlayerObjects(player);
     Network.RemoveRPCs(player);
 }

alt text

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tanoshimi · Jun 20, 2014 at 04:20 PM 1
Share

Look in the inspector- your Player prefab appears to have some missing scripts.

avatar image Landern · Jun 20, 2014 at 04:22 PM 0
Share

@tanoshimi +1

specifically look at the components in the inspector that just state (Script), there was a reference to a script(s) that are missing/deleted or the reference was lost somehow, either add them back or remove the component if no longer used

avatar image Wololo Plays · Jun 20, 2014 at 04:29 PM 0
Share

What do you mean? And what can be?

avatar image LukaKotar · Jun 20, 2014 at 04:56 PM 1
Share

As the error stated, the $$anonymous$$ain Camera object has a missing script component. I recommend downloading this editor script, it is very helpful when trying to find out which scripts are missing, and reassign them.

avatar image Wololo Plays · Jun 20, 2014 at 05:07 PM 0
Share

If I send the project. You tidy for me? I'm in trouble today.

Show more comments

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Problem with player movements 1 Answer

Damage the Player 1 Answer

Need help calling a script to another keep getting errors 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

(FIXED)This respawn code won't work! 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges