Search Unity

The class defined in script file named 'TeamDeathmatch' does not match the file name!

Discussion in 'Scripting' started by acropole, Nov 27, 2012.

  1. acropole

    acropole

    Joined:
    Aug 13, 2009
    Posts:
    171
    Hi,

    This warning break script compilation :

    This the class from TeamDeathmatch.cs

    Code (csharp):
    1. using UnityEngine;
    2. using System;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5.  
    6. namespace Abyss
    7. {
    8.     [AddComponentMenu("Abyss/Entities/Team Deathmatch")]
    9.     public class TeamDeathmatch : GameInfo
    10.     {
    11.         [SerializeField]
    12.         private int m_TeamCount = 2;
    13.         public int TeamCount
    14.         {
    15.             get
    16.             {
    17.                 return m_TeamCount;
    18.             }
    19.  
    20.             set
    21.             {
    22.                 m_TeamCount = value;
    23.             }
    24.         }
    25.  
    26.         private new List<List<PlayerStart>> m_PlayerStarts = new List<List<PlayerStart>>();
    27.         public new List<List<PlayerStart>> PlayerStarts
    28.         {
    29.             get
    30.             {
    31.                 return m_PlayerStarts;
    32.             }
    33.             protected set
    34.             {
    35.                 m_PlayerStarts = value;
    36.             }
    37.         }
    38.  
    39.         public override GUISpaceShipSelector SpaceShipSelector
    40.         {
    41.             get
    42.             {
    43.                 if (m_SpaceShipSelector == null)
    44.                     m_SpaceShipSelector = new GUITDMSpaceshipSelector();
    45.                 return base.SpaceShipSelector;
    46.             }
    47.         }
    48.  
    49.         public override void Awake()
    50.         {
    51.             base.Awake();
    52.  
    53.             for (int i = 0; i < TeamCount; i++)
    54.                 PlayerStarts.Add(new List<PlayerStart>());
    55.         }
    56.  
    57.         public override void RegisterPlayerStart(PlayerStart playerStart)
    58.         {
    59.             int team = playerStart.Team;
    60.             if (team < 0 || team >= TeamCount)
    61.             {
    62.                 Destroy(playerStart.gameObject);
    63.                 return;
    64.             }
    65.  
    66.             if (!PlayerStarts[team].Contains(playerStart))
    67.                 PlayerStarts[team].Add(playerStart);
    68.         }
    69.  
    70.         protected override List<PlayerStart> GetAvailablePlayerStarts(int team = 0)
    71.         {
    72.             if (team < 0 || team >= TeamCount)
    73.                 return null;
    74.  
    75.             return PlayerStarts[team];
    76.         }
    77.     }
    78. }
     
  2. acropole

    acropole

    Joined:
    Aug 13, 2009
    Posts:
    171
    Unlike said in the unity 4 changelog, namespaces are not supported. Removing namespace from all in scripts sovles this problem and many others.
    the "namespaces are now supported" feature should be removed from the changelog.