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
}
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.
Hello I tried it also it was a same problem bl_SettingProperties
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220612190054im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
JsonUtilty not found 1 Answer
A namespace cannot directly contain mambers such as fields or methods... 2 Answers
C# cant find a class auto generated by unity 2 Answers
Creating public variables 1 Answer
Get All Unity Namespaces (string array) 0 Answers