• 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 /
This question was closed Oct 30, 2014 at 01:05 PM by SaraCecilia for the following reason:

Duplicate Question

avatar image
0
Question by vishal5721 · Oct 30, 2014 at 01:02 PM · errorphotonpluginscs0246

error CS0246: The type or namespace name `SpawnSpot' could not be found. Are you missing a using directive or an assembly reference

Hi,

I am new to unity3d networking and i am trying to create multiplayer fps and i am stucked in an error which says type or namespace 'Game Object' could not be found.

Here is the code of my script

using UnityEngine;

using System.Collections;

public class NetworkManager : MonoBehaviour {

 public Camera standbyCamera; 
 public SpawnSpot[] spawnSpot;
 // Use this for initialization
 void Start () {
     spawnSpot = GameObject.FindObjectsOfType<SpawnSpot>();
     Connect ();
 }
 
 void Connect(){
     PhotonNetwork.ConnectUsingSettings ("MultiFPS v1.0.0");
 }
 void OnGUI(){
     GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString());
 }
 void OnJoinedLobby(){
     Debug.Log ("joined lobby");
     PhotonNetwork.JoinRandomRoom ();
 }
 void OnPhotonRandomJoinFailed(){
     Debug.Log ("OnPhotonRandomJoinFailed");
     PhotonNetwork.CreateRoom (null);
 }
 void OnJoinedRoom(){
     Debug.Log ("OnJoinedRoom");
     SpawnMyPlayer ();
 }
 void SpawnMyPlayer(){
     if (spawnSpot == null) {
         Debug.Log("No spawn spots");
         return;
     }
     spawnSpot mySpawnSpot = spawnSpot [Random.Range (0, spawnSpot.Length)];
     PhotonNetwork.Instantiate ("First Person Controller",mySpawnSpot.transform.position,mySpawnSpot.transform.rotation,0);
     standbyCamera.enabled = false;
 }

}

Comment
Add comment · Show 4
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 SaraCecilia · Oct 30, 2014 at 01:04 PM 0
Share

I would suggest using Google. http://answers.unity3d.com/questions/304724/error-cs0246-missing-type-or-namespace.html

avatar image vishal5721 · Oct 30, 2014 at 01:20 PM 0
Share

i have gone through that question but it has the problem of constructor naming convention and in my case i am not using constructor.

The problem is something else i guess

avatar image Wisearn · Oct 30, 2014 at 01:33 PM 0
Share
 spawnSpot mySpawnSpot = spawnSpot

the first spawnspot should be capital S like SpawnSpot, just like

 public SpawnSpot[] spawnSpot;



Also the answer that Sara posted points out 3 different problems, not just constructors... the problem you have is described similar here: "Your classes are named VigorScr and SkillScr but you are trying to use type Vigor and Skill" where you're trying to use spawnSpot as a class name when the class is actually named SpawnSpot

avatar image vishal5721 · Oct 31, 2014 at 05:09 AM 0
Share

I have tried SpawnSpot ins$$anonymous$$d of spawnSpot but it gives the same error.

It shows the error on the second line itself while initializing the SpawnSpot array i.e.

 public class Network$$anonymous$$anager : $$anonymous$$onoBehaviour {

 public Camera standbyCamera; 
 SpawnSpot[] spawnSpot;<---- the error is shown in this line

 // Use this for initialization
 void Start () {
     spawn = GameObject.FindObjectsOfType<SpawnSpot>();

     Connect ();
 }

 -------
 -------
 -------
 -------

 }

0 Replies

  • Sort: 

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Error CS0246 of plugins everytime the project is opened for the first time. 2 Answers

[error] Getting errors from Photon Networking when creating standalone! 0 Answers

Plugins colliding with each other, but they don't have names 1 Answer

Compiler errors? 2 Answers

[PUN] Why is my Photon script not working? Help! 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