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 Mishnab · Apr 25, 2014 at 02:49 PM · errornetworkingnetworkdefinitioncs0117

Unity doesn't recognize any definition for Network

I created a new project with the intent of learning how to create a server and connect to it but I have been stuck on the very first step:

if (Network.peerType == NetworkPeerType.Disconnected){

}

gives me an error CS0117 -error CS0117: Network' does not contain a definition for peerType'

I checked the scripting manual and everything seems to be in order.

Anyone might know whats the problem? Do I need scripting assets?

Edit: same thing happened for Network.connect(), he has no definition for it

Comment
Add comment · Show 5
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 Graham-Dunnett ♦♦ · Apr 25, 2014 at 03:11 PM 0
Share

Do you have using UnityEngine; at the top of your c# file, as per the example on the documentation page?

avatar image will_c · Apr 25, 2014 at 03:15 PM 0
Share

It's also case-sensitive, although I think you know since you wrote everything else correctly, just wanted to be sure. You wrote Network.connect(), the method is Connect()

avatar image Mishnab · Apr 25, 2014 at 03:16 PM 0
Share

Yes as well as Using.SystemCollection

avatar image Mishnab · Apr 25, 2014 at 03:18 PM 0
Share

Yup Connect with a capital C, bad copypasting on my part

avatar image will_c · Apr 25, 2014 at 03:27 PM 0
Share

Can you paste your entire script?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Mishnab · Apr 25, 2014 at 03:33 PM

My entire script

using UnityEngine; using System.Collections;

public class Network : MonoBehaviour {

 public string IP= "127.0.0.1";

 public int port=123;

 // Use this for initialization
 void Start () {
 
 }
 
 // Update is called once per frame
 void Update () {
 
 }
 void OnGUI(){ 
     if (Network.peerType == NetworkPeerType.Disconnected){


     }       
 }

}

Comment
Add comment · Show 3 · Share
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 ByteSheep · Apr 25, 2014 at 03:43 PM 1
Share

The file you created is called 'Network' - you will have to rename it to something which doesn't conflict with the existing Network class I think.

avatar image will_c · Apr 25, 2014 at 03:44 PM 0
Share

Precisely what was said above.

avatar image Mishnab · Apr 25, 2014 at 03:53 PM 0
Share

Thanks a bunch! can't believe i didnt see it!

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

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Client timeout disconnecting on local server and in internet match. 0 Answers

Syncing terrain over Network 0 Answers

Command method dont change variables on server 0 Answers

Creating a multiplayer game. 1 Answer

Need help with networking 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