• 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 /
  • Help Room /
avatar image
0
Question by Lukyna05 · Jan 19, 2019 at 10:01 PM · namespace

I have problem with the type name or namespace name 'bl_SettingPropiertis' could not be found. Please help me with this.

Hello, I have problem with the script bl_BombDefuse. I have this error: Assets/Addons/BombDefuse/Content/Scripts/bl_BombDefuse.cs(34,13): error CS0246: The type or namespace name `bl_SettingPropiertis' could not be found. Are you missing an assembly reference?. Please help me with this.

Here is the script:

using UnityEngine; using System.Collections; using Hashtable = ExitGames.Client.Photon.Hashtable;

[RequireComponent(typeof(PhotonView))] public class bl_BombDefuse : bl_PhotonHelper { [HideInInspector]public int ID; [Header("Settings")] public Team BombTeam = Team.All; public float TimeToExplote = 20f; public float TimeToActive = 7; public float TimeForNextRound = 5; public int XPForExplote = 200; [HideInInspector] public string ActorPlant = ""; [Header("Effects")] public GameObject BombObject; public GameObject ExplosionEffect; public AudioClip BipSound; public AudioClip ExplosionSound; public AudioSource Source; public Light RedLight; public AnimationCurve LightCurve;

 [Header("UI")]
 public GUISkin Skin;
 public Texture2D BackBar;
 public Texture2D BarTexture;


 private bl_GameManager GameManager;
 private bl_SettingPropiertis SettingsPropierties;

 private bool isBussy = false;
 private float TimeRemaing;
 private float TimeRemaingDesactive;
 private float countdown;
 private bool CanPlant = false;
 private bool CanDesactive = false;
 private float BarProgress;
 private float BarProgressDesactive;
 private bool Active = false;
 private bool BombDone = false;
 private bool RoundFinish = false;
 string lastWinner = "";
 private string LastPlayerIn;
 private bool CanUseThis = true;
 private bl_BombDefuse[] AllBombs;

 /// <summary>
 /// 
 /// </summary>
 void Awake()
 {
     GameManager = FindObjectOfType<bl_GameManager>();
     SettingsPropierties = FindObjectOfType<bl_SettingPropiertis>();
     GetBombs();
     TimeRemaing = TimeToActive;
     BarProgress = TimeToActive;
     BarProgressDesactive = TimeToActive;
     countdown = TimeToExplote;
     Source.clip = BipSound;
 }

 

 void GetBombs()
 {
     AllBombs = FindObjectsOfType<bl_BombDefuse>();
     for(int i = 0; i < AllBombs.Length; i++)
     {
         AllBombs[i].ID = i;
     }
 }

 #region Triggers
 /// <summary>
 /// 
 /// </summary>
 /// <param name="c"></param>
 void OnTriggerEnter(Collider c)
 {
     if (isBussy)
         return;
     if (!CanUseThis)
         return;

     if (c.transform.tag == bl_PlayerSettings.LocalTag)
     {
         PhotonView v = c.gameObject.GetPhotonView();
         if (v == null)
         {
             Debug.LogWarning("This object doesn't have a photonview");
         }
         if (!Active)
         {
             if (v.owner.GetPlayerTeam() != BombTeam)
             {
                 CanPlant = true;
             }
         }
         else
         {
             if (v.owner.GetPlayerTeam() == BombTeam)
             {
                 CanDesactive = true;
             }
         }
     }
 }

 /// <summary>
 /// 
 /// </summary>
 /// <param name="c"></param>
 void OnTriggerExit(Collider c)
 {
     if (c.transform.tag == bl_PlayerSettings.LocalTag)
     {
         if (c.gameObject.name == ActorPlant)
         {
             photonView.RPC("StartPlantBomb", PhotonTargets.AllBuffered, false);

         }
         CanPlant = false;
         CanDesactive = false;
     }
 }
 #endregion

 /// <summary>
 /// 
 /// </summary>
 void CountDown()
 {
     TimeRemaing -= 1;
     if (TimeRemaing <= 0)
     {
         CancelInvoke("CountDown");
         TimeRemaing = 0;
         photonView.RPC("BombActive", PhotonTargets.AllBuffered, true,ID);
     }
 }


 /// <summary>
 /// 
 /// </summary>
 void CountDownDesactive()
 {
     TimeRemaingDesactive -= 1;
     if (TimeRemaingDesactive <= 0)
     {
         CancelInvoke("CountDownDesactive");
         TimeRemaingDesactive = 0;
         photonView.RPC("DesactiveBomb", PhotonTargets.AllBuffered);
     }
 }

 /// <summary>
 /// 
 /// </summary>
 void Update()
 {
     if (BombDone)
         return;
     if (!CanUseThis)
     {
         CanPlant = false;
         Active = false;
         return;
     }

     if (CanPlant)
     {
         PlantLogic();
     }
     if (CanDesactive)
     {
         DesactiveLogic();
     }
     if (Active)
     {
         ActiveCountDown();
     }
     LightControll();
 }

 float lightAlpha;
 float curveTime;
 void LightControll()
 {
     if (Active)
     {
         curveTime += Time.deltaTime * 1.7f;
         lightAlpha = LightCurve.Evaluate(curveTime);
     }
     else
     {
         lightAlpha = Mathf.Lerp(lightAlpha, 0, Time.deltaTime * 2);
     }
     RedLight.intensity = lightAlpha;
 }

 /// <summary>
 /// 
 /// </summary>
 private bool StartDesactive;
 void DesactiveLogic()
 {
     if (Input.GetKey(KeyCode.E) && CanDesactive)
     {
         if (!StartDesactive)
         {
             StartDesactive = true;
             photonView.RPC("StartDesactiveBomb", PhotonTargets.AllBuffered, true);
         }
     }
     else
     {
         if (StartDesactive)
         {
             StartDesactive = false;
             photonView.RPC("StartDesactiveBomb", PhotonTargets.AllBuffered, false);
         }
         TimeRemaingDesactive = TimeToActive;
     }
 }

 /// <summary>
 /// 
 /// </summary>
 void ActiveCountDown()
 {
     countdown -= Time.deltaTime;
     if (countdown > 0)
     {
         if (!Source.isPlaying)
         {
             Source.PlayDelayed(0.8f);
         }
     }
     if (countdown <= 0)
     {
         countdown = 0;
         BombDone = true;
         StartCoroutine(ExplosionSecuence());
         if (ActorPlant == PhotonNetwork.playerName)
         {
             PhotonNetwork.player.PostScore(XPForExplote);
         }
     }
 }

 /// <summary>
 /// 
 /// </summary>
 void WonDone()
 {
     if (!PhotonNetwork.isMasterClient)
         return;

     int dscore = 0;
     Hashtable prod = new Hashtable();
     if (this.BombTeam == Team.Recon)
     {
         dscore = (int)PhotonNetwork.room.CustomProperties[PropiertiesKeys.Team1Score];
         dscore++;
         prod.Add(PropiertiesKeys.Team1Score, dscore);
         lastWinner = "Delta";
     }
     else if (this.BombTeam == Team.Delta)
     {
         dscore = (int)PhotonNetwork.room.CustomProperties[PropiertiesKeys.Team2Score];
         dscore++;
         prod.Add(PropiertiesKeys.Team2Score, dscore);
         lastWinner = "Recon";
     }

     PhotonNetwork.room.SetCustomProperties(prod);
 }

 void WonDoneByDefuse()
 {
     if (!PhotonNetwork.isMasterClient)
         return;

     int dscore = 0;
     Hashtable prod = new Hashtable();
     if (this.BombTeam == Team.Recon)
     {
         dscore = (int)PhotonNetwork.room.CustomProperties[PropiertiesKeys.Team2Score];
         dscore++;
         prod.Add(PropiertiesKeys.Team2Score, dscore);
         lastWinner = "Recon";
     }
     else if (this.BombTeam == Team.Delta)
     {
         dscore = (int)PhotonNetwork.room.CustomProperties[PropiertiesKeys.Team1Score];
         dscore++;
         prod.Add(PropiertiesKeys.Team1Score, dscore);
         lastWinner = "Delta";
     }

     PhotonNetwork.room.SetCustomProperties(prod);
 }

 /// <summary>
 /// 
 /// </summary>
 void GetWinner(bool byDefuse = false)
 {
     if (this.BombTeam == Team.Recon)
     {
         lastWinner = (byDefuse) ? "Recon" : "Delta";
     }
     else if (this.BombTeam == Team.Delta)
     {
         lastWinner = (byDefuse) ? "Delta" : "Recon";
     }
 }

 private bool isStart = false;
 /// <summary>
 /// 
 /// </summary>
 void PlantLogic()
 {
     if (Input.GetKey(KeyCode.E) && CanPlant)
     {
         if (!isStart)
         {
             isStart = true;
             photonView.RPC("StartPlantBomb", PhotonTargets.AllBuffered, true);
         }
         if (ActorPlant == LocalName)
         {

         }
     }
     else
     {
         if (isStart)
         {
             isStart = false;
             photonView.RPC("StartPlantBomb", PhotonTargets.AllBuffered, false);
         }
         TimeRemaing = TimeToActive;
     }
 }

 /// <summary>
 /// 
 /// </summary>
 public void Reset()
 {
     countdown = TimeToExplote;
     TimeRemaing = TimeToActive;
     TimeRemaingDesactive = TimeToActive;
     BombDone = false;
     CanPlant = false;
     CanDesactive = false;
     isStart = false;
     isBussy = false;
     lightAlpha = 0;
     curveTime = 0;
     BombObject.SetActive(true);
     StartDesactive = false;
     RedLight.intensity = 0;
     Active = false;
     RoundFinish = false;
     CanUseThis = true;
     Debug.Log("Reset");
 }


 public void PlayerReset()
 {
     CanPlant = false;
     CanDesactive = false;
     StartCoroutine(checkAgain());
 }

 /// <summary>
 /// 
 /// </summary>
 void OnGUI()
 {
     GUI.skin = Skin;
     if (!Active)
     {
         if (CanPlant && !isStart)
         {
             GUI.Label(new Rect(Screen.width / 2 - 75, Screen.height / 2 + 50, 250, 50), "Press [E] to plant bomb!.");
         }
         if (isStart && CanPlant)
         {
             GUI.Label(new Rect(Screen.width / 2 - 75, Screen.height / 2 + 50, 350, 70), "Activating bomb in: " + TimeRemaing.ToString("0.0"));
             BarProgress = Mathf.Lerp(BarProgress, (TimeRemaing - 1), Time.deltaTime / 2f);
             GUI.DrawTexture(new Rect(Screen.width / 2 - 75, Screen.height / 2 + 110, TimeToActive * 30, 15), BackBar);
             GUI.DrawTexture(new Rect(Screen.width / 2 - 75, Screen.height / 2 + 110, BarProgress * 30, 15), BarTexture);
         }
     }
     else
     {
         if (CanDesactive && !StartDesactive)
         {
             GUI.Label(new Rect(Screen.width / 2 - 75, Screen.height / 2 + 50, 250, 50), "Press [E] to desactive the bomb!.");
         }
         if (CanDesactive && StartDesactive)
         {
             GUI.Label(new Rect(Screen.width / 2 - 75, Screen.height / 2 + 50, 350, 70), "Desactive bomb in: " + TimeRemaingDesactive.ToString("0.0"));
             BarProgressDesactive = Mathf.Lerp(BarProgressDesactive, (TimeRemaingDesactive - 1), Time.deltaTime / 2f);
             GUI.DrawTexture(new Rect(Screen.width / 2 - 75, Screen.height / 2 + 110, TimeToActive * 30, 15), BackBar);
             GUI.DrawTexture(new Rect(Screen.width / 2 - 75, Screen.height / 2 + 110, BarProgressDesactive * 30, 15), BarTexture);
         }
     }

     if (Active && !RoundFinish)
     {
         GUI.color = (countdown <= 5) ? Color.red : Color.white;
         GUI.Label(new Rect(10, Screen.height - 175, 350, 50), BombTeam.ToString() + " Bomb will explode in: " + countdown.ToString("00.0"));
         GUI.color = Color.white;
     }
     GUI.depth = -600;
     if (RoundFinish)
     {
         GUI.Label(new Rect(Screen.width / 2 - 65, Screen.height / 2 + 10, 300, 70), "Team " + lastWinner + " Won!. \n \t <size=10>Wait...</size>");
     }
 }

 #region RPCs

 /// <summary>
 /// 
 /// </summary>
 /// <param name="enter"></param>
 /// <param name="sender"></param>
 [PunRPC]
 void StartPlantBomb(bool enter, PhotonMessageInfo sender)
 {
     ActorPlant = sender.sender.NickName;
     if (enter)
     {
         isBussy = true;
         if (sender.sender == PhotonNetwork.player)
         {
             InvokeRepeating("CountDown", 1, 1);
         }
     }
     else
     {
         isBussy = false;
         if (sender.sender == PhotonNetwork.player)
         {
             CancelInvoke("CountDown");
             TimeRemaing = TimeToActive;
             BarProgress = TimeRemaing;
         }
     }
 }

 /// <summary>
 /// 
 /// </summary>
 /// <param name="enter"></param>
 /// <param name="sender"></param>
 [PunRPC]
 void StartDesactiveBomb(bool enter, PhotonMessageInfo sender)
 {
     if (enter)
     {
         isBussy = true;
         if (sender.sender == PhotonNetwork.player)
         {
             InvokeRepeating("CountDownDesactive", 1, 1);
         }
     }
     else
     {
         isBussy = false;
         if (sender.sender == PhotonNetwork.player)
         {
             CancelInvoke("CountDownDesactive");
             TimeRemaingDesactive = TimeToActive;
             BarProgressDesactive = TimeRemaingDesactive;
         }
     }
 }

 /// <summary>
 /// 
 /// </summary>
 /// <param name="act"></param>
 /// <param name="sender"></param>
 [PunRPC]
 void BombActive(bool act,int _id, PhotonMessageInfo sender)
 {
     if (act)
     {
         Active = true;
         isBussy = false;
         foreach(bl_BombDefuse bd in AllBombs)
         {
             bd.DesactiveOther(_id);
         }
     }
     else
     {
         Active = false;
         countdown = TimeToExplote;
         isBussy = false;
     }
 }

 [PunRPC]
 void DesactiveBomb(PhotonMessageInfo sender)
 {
     Reset();
     StartCoroutine(BombDefuseSecuence());
     if (sender.sender.NickName == PhotonNetwork.playerName)
     {
         PhotonNetwork.player.PostScore(XPForExplote);
     }
 }
  
 public void DesactiveOther(int theActive)
 {
     if (theActive == this.ID)
         return;

     CanUseThis = false;
     BombObject.SetActive(false);
 }
 #endregion

 #region Corrutines

 IEnumerator checkAgain()
 {
     yield return new WaitForSeconds(1);
     CanPlant = false;
     CanDesactive = false;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 IEnumerator ExplosionSecuence()
 {
     AudioSource.PlayClipAtPoint(ExplosionSound, transform.position);
     GameObject e = Instantiate(ExplosionEffect, transform.position, Quaternion.identity) as GameObject;
     Destroy(e, 7);
     BombObject.SetActive(false);
     yield return new WaitForSeconds(1.2f);


     AudioSource.PlayClipAtPoint(ExplosionSound, transform.position);
     GameObject fe = Instantiate(ExplosionEffect, transform.position, Quaternion.identity) as GameObject;
     Destroy(fe, 7);
     StartCoroutine(GameManager.GetComponent<bl_RoomMenu>().FadeIn());


     yield return new WaitForSeconds(0.85f);

     if (PhotonNetwork.isMasterClient) { WonDone(); } else { GetWinner(); }

     RoundFinish = true;
     AudioSource.PlayClipAtPoint(ExplosionSound, transform.position);
     GameObject f = Instantiate(ExplosionEffect, transform.position, Quaternion.identity) as GameObject;
     Destroy(f, 7);

     //This is a good place for save info in your DataBase

     yield return new WaitForSeconds(TimeForNextRound);
     //If still missing rounds
     if (SettingsPropierties.CheckForBDRound)
     {
         foreach (bl_BombDefuse bd in AllBombs) { bd.Reset(); }
         GameManager.GetComponent<bl_GameManager>().SpawnPlayer(PhotonNetwork.player.GetPlayerTeam());
     }
     else//if rached max rounds
     {
         PhotonNetwork.LeaveRoom();
         bl_UtilityHelper.LockCursor(false);
     }
 }

 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 IEnumerator BombDefuseSecuence()
 {
     if (PhotonNetwork.isMasterClient) { WonDoneByDefuse(); } else { GetWinner(true); }
     RoundFinish = true;
     StartCoroutine(GameManager.GetComponent<bl_RoomMenu>().FadeIn());
     yield return new WaitForSeconds(TimeForNextRound);
     //If still missing rounds
     if (SettingsPropierties.CheckForBDRound)
     {
         foreach (bl_BombDefuse bd in AllBombs) { bd.Reset(); }
         GameManager.GetComponent<bl_GameManager>().SpawnPlayer(PhotonNetwork.player.GetPlayerTeam());
     }
     else//if rached max rounds
     {
         PhotonNetwork.LeaveRoom();
         bl_UtilityHelper.LockCursor(false);
     }
 }
 #endregion

}

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by xxmariofer · Jan 19, 2019 at 11:05 PM

Pretty sure you just missspelled bl_SettingPropiertis , try changing it to bl_SettingProperties, the error says that namespace doesnt exist in your project.

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 Lukyna05 · Jan 20, 2019 at 10:06 AM 0
Share

Hello I tried it also it was a same problem bl_SettingProperties

avatar image xxmariofer Lukyna05 · Jan 20, 2019 at 07:51 PM 0
Share

I imagine that code is from a third party, your problem is that Unity doesnt find anything in your code class or namespace. if you are sure your code was copied fine there must be something, a script or plugin or something that is missing. but check if it doesnt exist a class with a really similar name that might be misspelled.

avatar image Lukyna05 xxmariofer · Jan 20, 2019 at 08:52 PM 0
Share

Ok, I try this way

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

165 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image

Related Questions

Why is VS15 throwing errors for missing namespace 'UnityEngine' when it is already included 0 Answers

UnityEngine does not exist in this context 0 Answers

Issues with namespaces and folder structure 1 Answer

Using 2 different namespaces 1 Answer

Namespace Media does not exist 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