Quantcast
Channel: Questions in topic: "namespace"
Viewing all 398 articles
Browse latest View live

Unity namespace cannot be found (C# MonoDevelop)

$
0
0
Hi, just having a little issue here. I updated from 5.5 to 5.6 and all my scripts aren't recognizing the Unity namespace in MonoDevelop (C#). The game still compiles without any errors, but it annoys me to see almost everything red in MonoDevelop. Everything I've read about this is that you need to delete the .../MyProject/Library/UnityAssemblies folder. I checked, and I don't have that folder. It's ScriptAssemblies instead. So naturally, I tried to delete it. It regenerated but did not solve the problem. I did save a backup of the old ScriptAssemblies just in case. I'm also using Rewired. It recognizes it up in the other namespace declarations, but it marks the "Player" class variable (from Rewired) as red. Help...!?

Having problem with 2D Roguelike tutorial Error: " error CS0101: The namespace `Completed' already contains a definition for `BoardManager'"

$
0
0
I am having problems with 2D Roguelike and I get an error code; error CS0101: The namespace `Completed' already contains a definition for 'BoardManager'` Anytime if "namespace Completed" is removed i get error CS8025: `Parsing error`. Can someone help me and explain the problem because I do not these errors

Why can't compiler find Physics.ClosestPoint or Collider.ClosestPoint?

$
0
0
So according to the documentation these functions exist: https://docs.unity3d.com/ScriptReference/Physics.ClosestPoint.html https://docs.unity3d.com/ScriptReference/Collider.ClosestPoint.html However my Unity isn't able to find either of them. error CS0117: `UnityEngine.Physics' does not contain a definition for `ClosestPoint' error CS1061: Type `UnityEngine.Collider' does not contain a definition for `ClosestPoint' and no extension method `ClosestPoint' of type `UnityEngine.Collider' could be found. Are you missing an assembly reference? I tried various usings such as: using Collider; using UnityEngine.Collider; But those aren't namespaces, ect. Idk why that would be necessary since I can use Collider & Physics functions otherwise. I just updated to 5.5.4f1 and still have the problem. What is going on?

the type or namespace name 'CBBinding' could not be found.,the name 'CBBinding' does not exist in the current context

$
0
0
using UnityEngine; using System.Collections; using Chartboost; public class CBads : MonoBehaviour { public bool shown = false; // Use this for initialization private CBads CB; private CBManager void Start () { #if UNITY_ANDROID CBBinding.init(); #endif CB.cacheInterstitial(null); CB.showInterstitial(null); } public void ShowAd(string location = null){ CB.showInterstitial(location); } void OnEnable() { // Listen to all impression-related events CBManager.didFailToLoadInterstitialEvent += didFailToLoadInterstitialEvent; CBManager.didDismissInterstitialEvent += didDismissInterstitialEvent; CBManager.didCloseInterstitialEvent += didCloseInterstitialEvent; CBManager.didClickInterstitialEvent += didClickInterstitialEvent; CBManager.didShowInterstitialEvent += didShowInterstitialEvent; } void OnDisable() { // Remove event handlers CBManager.didFailToLoadInterstitialEvent -= didFailToLoadInterstitialEvent; CBManager.didDismissInterstitialEvent -= didDismissInterstitialEvent; CBManager.didCloseInterstitialEvent -= didCloseInterstitialEvent; CBManager.didClickInterstitialEvent -= didClickInterstitialEvent; CBManager.didShowInterstitialEvent -= didShowInterstitialEvent; } void didFailToLoadInterstitialEvent( string location ){ shown = false; } void didDismissInterstitialEvent( string location ){ CB.cacheInterstitial(location); shown = true; } void didCloseInterstitialEvent( string location ){ shown = true; } void didClickInterstitialEvent( string location ){ shown = true; } void didShowInterstitialEvent( string location ){ shown = true; } }

What are the unityeditorinternal and the unityengineinternal namespace and why are they missing from the docs ?

$
0
0
When I type "using" intelisense give me two namespaces those I never heard about and missing from the docs: __UnityEditorInternal__ and __UnityEngineInternal__ or maybe I didn' found them. What are these namespaces used for and why are they missing from the docs?

CompilerParameters not found in System.CodeDom.Compiler

$
0
0
Hey folks, I am trying to use YieldProlog in my project but I am having a rather peculiar issue. Although I am using the namespace System.CodeDom.Compiler and my references include, obviously, the System.dll, CompilerParameters appears as unavailable (non existent) in my project. Even in the object browser, System.CodeDom.Compiler has only a GeneratedCodeAttribute method, and nothing else. Any pointers or ideas? I already attempted to move all the source throughout different folders such as Library, Plugins etc... nothing. The message is clear, the problem is not: "The type or namespace name "CompilerParameters" could not be found"

Dumb Question - Can't use Standard Assets package in scripts.

$
0
0
I've imported Standard Assets 2D and CrossPlatformInput. However when I make a new script I can't `using UnityStandardAssets` or `UnityStandardAssets.CrossPlatformInput`, MonoDevelop just doesn;t recognise it, and throws an error. What am I doing wrong?

Unity 5.6.0p3 does not recognize class inside namespace

$
0
0
This works: using Zenject; public class UiSignalInstaller : MonoInstaller { public override void InstallBindings() { Container.DeclareSignal(); Container.Bind().AsSingle().NonLazy(); } } public class RoomSelectionChangedSignal : Signal { } This does not: namespace Zenject.Installers.UI { public class UiSignalInstaller : MonoInstaller { public override void InstallBindings() { Container.DeclareSignal(); Container.Bind().AsSingle().NonLazy(); } } public class RoomSelectionChangedSignal : Signal { } } The library Zenject is placed under Plugins if this matters. I don't get a specific error warning, just "fix compiler issues" which is very unspecific. The only reason I found the solution is by trial-and-error. I just realized there are tons of cases where the compiler is warning wrongly. Even if a variable is passed as parameter to a method. I am pretty sure this should not be the case.

Create asset bundle on backend - using Unity namespace in backend app

$
0
0
Hello! I am going to give possibility for user to upload content (some 3d model) from web CMS and then, in Mobile App created with Unity - download it and show for user. Please tell me - is there a possibility to include Unity namespace into some Mono .Net Web App (for example MVC?). What I would like to achieve is build an Asset Bundle package on server. Thank you in advance for answers!

Error CS0234: The type or namespace name `IActiveBuildTargetChanged' does not exist in the namespace `UnityEditor.Build'. Even after moving Editor folder.

$
0
0
Hi, I was searching for this error and I found [this](http://answers.unity3d.com/questions/1114080/the-type-or-namespace-name-unityeditor-could-not-b-2.html ) answer but it is not working. I moved Editor folder from StandardAssets/CrossPlatformInput/Scripts to StandardAssets folder and it is still throwing this error. I tried to put this folder in every single other folder but it is still not working. Should I put ALL scrips in Editor folder? I'm using Unity 5.6.2 on WIndows, and I imported whole CrossPlatformInput package and also couple of other standard packages.

Namespace error from external assets

$
0
0
Hi everyone, english is not my first language so i'll try to explain you the problem as well as i can. I'm working on a project compiled from many people before me so i don't really know what did they do in it. This project contains a lot of assets imported from the asset store and, when i try to build it, every namespace relative to those assets give me the classic error "The type or namespace name `com' could not be found. Are you missing an assembly reference?" Every asset is in the Assets folder so I don't really know what to do to fix those 60 errors.

Is there a way to see namespaces in Editor ? (complete class name)

$
0
0
Hi, Unity doesn't show complete class name, this can be confusing, for instance with the search box in the inspector. (if same class name but different namespace) Is there a solution or good practices?

Compiled managed dll that references Unity APIs from different Unity versions

$
0
0
Let's say there's some API A in Unity 5.6.x that is deprecated in 2017 and there is some other API B in 2017 that does not exist yet in 5.6.x. Is there any way to create a compiled managed dll that uses API A when run in 5.6.x and API B when run in 2017? It doesn't seem to be possible to use conditional compilation since the defines are evaluated when the dll is generated. As a more tangible example, 5.6.x has UnityEngine.VR.VRSettings while 2017.2b has UnityEngine.XR.XRSettings. Can a compiled dll be created that supports both versions if the code depends on these settings?

error CS0118: 'Player' is a 'namespace' but a 'type' was expected

$
0
0
using System.Collections; using System.Collections.Generic; using UnityEngine; using Player ; namespace Player { public class MonoBehaviour { Player pl1 = new Player (); GameObject [] pauseObjects; GameObject [] finishObjects; //player Player; void OnTriggerEnter2D(Collider2D other){ if(other.gameObject.tag == "Player"){ other.gameObject.GetComponent().alive = false; Time.timeScale = 0; } } void Start () { Time.timeScale = 1; pauseObjects = GameObject.FindGameObjectsWithTag("ShowOnPause"); //gets all objects with tag ShowOnPause finishObjects = GameObject.FindGameObjectsWithTag("ShowOnFinish"); //gets all objects with tag ShowOnFinish hidePaused(); hideFinished(); //Checks to make sure MainLevel is the loaded level if(Application.loadedLevelName == "MainLevel") playerController = GameObject.FindGameObjectWithTag("Player").GetComponent(); } void Update () { if(Input.GetKeyDown(KeyCode.P)) { if(Time.timeScale == 1 && player.alive == true) { Time.timeScale = 0; showPaused(); } else if (Time.timeScale == 0 && player.alive == true){ Time.timeScale = 1; hidePaused(); } } } public void Reload(){ Application.LoadLevel(Application.loadedLevel); } public void pauseControl(){ if(Time.timeScale == 1) { Time.timeScale = 0; showPaused(); } else if (Time.timeScale == 0){ Time.timeScale = 1; hidePaused(); } } public void showPaused(){ foreach(GameObject g in pauseObjects){ g.SetActive(true); } } //hides objects with ShowOnPause tag public void hidePaused(){ foreach(GameObject g in pauseObjects){ g.SetActive(false); } } //shows objects with ShowOnFinish tag public void showFinished(){ foreach(GameObject g in finishObjects){ g.SetActive(true); } } //hides objects with ShowOnFinish tag public void hideFinished(){ foreach(GameObject g in finishObjects){ g.SetActive(false); } } //loads inputted level public void LoadLevel(string level){ Application.LoadLevel(level); } } }

Assets/Looper.cs(4,23): error CS0246: The type or namespace name `MonoBehaviour' could not be found. Are you missing an assembly reference?.

$
0
0
hey everybody i've got this script from someone but it wont work and i can't get it to work it keeps giving me this error IN CONSOLE Assets/Looper.cs(4,23): error CS0246: The type or namespace name `MonoBehaviour' could not be found. Are you missing an assembly reference?. Error building Player because scripts had compiler errors this notification comes out after I build into a file with exe extension, in Microsoft Visual Studio it successful build and compile but error in build and run to axe. please give me solution and tips to solve this problem. ![alt text][1] using System.Collections; using System.Collections.Generic; using UnityEngine; public class Looper : MonoBehaviour { int number1, number2, number3, number4, number5, countdown; // Use this for initialization void Start () { number1 = 0; number2 = 0; number3 = 0; number4 = 0; number5 = 0; countdown = 3; InvokeRepeating("CountDown", 1, 1); } // Update is called once per frame void Update () { if (countdown == 0) { number1++; } } void FixedUpdate() { if (countdown == 0) { number2++; } } void CountDown(){ countdown--; if (countdown == 0) { InvokeRepeating("Looping1", 1, 1); InvokeRepeating("Looping2", 5, 0.5f); Invoke("NoLooping", 10); CancelInvoke("CountDown"); } } void Looping1() { number3++; } void Looping2() { number4++; } void NoLooping() { number5++; } void OnGUI() { GUILayout.BeginArea(new Rect(10, 10, 400, 200)); if (countdown == 0) { GUILayout.Label("Update Increment:" + number1.ToString()); GUILayout.Label("FixedUpdate Increment" + number2.ToString()); GUILayout.Label("Start At:1 Sec(Interval 1):" + number3.ToString()); GUILayout.Label("Start At:5 Sec(Interval 0.5): " + number4.ToString()); GUILayout.Label("Star At :10 Sec(Looping): " + number5.ToString()); } else { GUILayout.Label("Count Down:" + countdown.ToString()); } GUILayout.EndArea(); } } [1]: /storage/temp/101857-tompel.png

UnityEngine found but MonoBehaviour or Vector3 not found in MonoDevelop

$
0
0
Hi all, I have recently noticed that UnityEngine dependencies were not recognized in MonoDevelop for one of my projects. It works fine for all my other projects, even ones made last year. And UnityEngine itself is not highlighted. It seems to work fine in VS as well. I get the error CS0103 : "MonoBehaviour" doesn't exist in the current context. Yet, Unity is able to compile the code and I get no errors in the console, and the game play mode work fine. The real issue is that without MonoBehaviour auto-complete it is very hard to write code as I keep having to re-write things over and over due to auto-complete to things which are not MonoBehaviour. Any suggestions would be much appreciated. Feel free to comment to ask for particular setting details or info. I don't really know where the problem comes from so I don't know what extra info to provide. Thanks

Namespace not working

$
0
0
I am making a script that should simplify things for other scripts, and to use the functions I decided to use a namespace. The script looks like this: using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Namespace { public class Helper : MonoBehaviour { public Value value1; private Value value2; private Value value3 public void SetValues(value number, value number2) { value2 = number; value3 = number2; } public void Activate() { // some code here StartCoroutine(Cooldown); } public IEnumerator Cooldown() { //some code here } } } I can use the `using Namespace;` and when I want to acces a funtion like `Helper.Activate();` it recognize the `Helper` but the `Activate()` isn't recognized. Can someone help me with this issue?

.NET dll seen as native in Unity3D

$
0
0
I got a NI USB-6001 I/O device but it cant be used in unity3D. The purpose of the hardware here is to connect buttons, joystick, switches etc. to it and then to read it out by using the API and turning the channel values into parameters that can be used in de simulation. Basicly the point is to make a custom controller for unity3D. But i have the following problem with trying to use NI hardware as I/O. ![alt text][1] If the NationalInstruments.DAQmx.dll gets imported into Unity3D it is recognized as a type Native .dll and not a .NET .dll which it should be. Because of this it wont be added to the references what results in the namespace name not existing. Does anyone know if there is a way to resolve this? [1]: /storage/temp/104483-ni-dll.png

Variable type Target Unity

$
0
0
The script (In C#): public class Gun : MonoBehaviour { public GameObject enemy; // Use this for initialization void Start () { } public float damage = 100f; // Update is called once per frame void Update () { if (Input.GetButtonDown("Fire1")) { shoot(); } } void shoot() { RaycastHit hit; if (Physics.Raycast(transform.position,transform.forward, out hit)) { Target targ = GetComponent(); if (enemy != null) { Destroy(enemy); } } } } Okay, so here is the line of code which is not working: Target targ = GetComponent(); in which I am trying to create a variable type target as I saw in this video: https://www.youtube.com/watch?v=THnivyG0Mvo However, when I tried to do this it tells me the type or namespace "Target" could not be found (are you missing a using directive or an assembly reference?) And I already tried looking for errors on this and some people say this error is caused because the script is named "Target" however, that is not the case for me as this script is labelled as Gun. Could somebody please tell me how I could fix this line of code? (Also the entire script isn't the ideal one, I plan to replace the Destroy(gameObject) with something more suitable if I could find the solution to my problem.

Get All Unity Namespaces (string array)

$
0
0
Hi All, I'm making a custom file creator, where you can specify your file name, location, and also the namespaces to include. I've been able to include all generic c# namespaces, as well as any custom ones (GetExecutingAssembly() and GetCallingAssembly(), respectively), but these do not include namespaces such as UnityEngine, UnityEngine.AI, etc. Does anyone know how I can get a list of all of these namespaces?
Viewing all 398 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>