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

error CSO246: The type or namespace "Nunit" could not be found.

$
0
0
400+ of these errors pop up when ever i open unity.Even with new projects.It was good until i restored my pc. After that is starts giving these errors.So , i reinstalled Unity. But it doesn't work.

How to make namespaces appear in the AddComponent List automatically?

$
0
0
Let's say I have a component called Platform within the namespace Hardware. Then let's say I have another component Platform within the namespace GameEntity. Both inherit from monobehaviour. So when I go to add a component to a gameobject from the add component menu I'll see two items named 'Platform'. Is there a way to tell which is which without adding them and checking the file. Ideally the component list would read Hardware.Platform and GameEntity.Platform. And for the sake of this question, let's pretend that I can't just rename my scripts. The best I can find right now is -> AddComponentMenu("Hardware.Platform")] <- at the top of each class but that doesn't actually remove the original 'Platform' from the component menu and I'd rather unity just use the namespaces automatically rather than having to do it manually each time.

Hello there I am getting 'the type or namespace 'Controller' could not be found (are you missing an assembly reference?'

$
0
0
I am using Unity 2019.3 and also cannot find the script when I assign it to a character. I saw using System.Web.Mvc can fix it but it cannot find the package to install it. Any help what should I do? and What to learn for future similar issues? Like learning about libraries, packages... Thanks

Extension class won't recognize the type in some imported namespace

$
0
0
Hello, Please help, i'm losing my mind. I created a class for housing a Quaternion extension method. However, after "successfully" importing the unity engine namespace, the Quaternion struct (class?) still goes unrecognized. I could go and explicitly add the "UnityEngine.Quaternion" namespace qualifier in front of each every occurrence of the Quaternion type name in the file. Though, that would be ugly. I've added a screen cap of the class. The namespace of this extension method's class is shown at the very top of the image -FYI. Please help, i have many other extension methods that i need to add later, and adding the "UnityEngine" namespace qualifier in front of each and every occurrence of "Quaternion" would be suck. Thanks in advance. ![alt text][1] [1]: /storage/temp/154193-wtf-no-import-namespace.png

The type or namespace name 'HighDefinition' does not exist in the namespace 'UnityEngine.Rendering' (are you missing an assembly reference?)

$
0
0
I keep getting this error, and I'm not sure what I'm missing do I need to install extra stuff? **The type or namespace name 'HighDefinition' does not exist in the namespace 'UnityEngine.Rendering' (are you missing an assembly reference?)** I'm using Lightweight RP. And I Assume that Lightweight includes HighDefinition scripts.

How do I acquire the knowledge of every Unity namespace and every Unity capability at my disposal?

$
0
0
Im new to Unity and I understand the whole `using MagicalLibraryOfTools` syntax ..but i cannot find a list of all said magical libraries of predefined classes and their methods. I feel like a mother list like that would help me get a grasp on all the things i can do with Unity (that don't require me reinventing the wheel)

How to solve "The type x exists in both y aand z"?,How to solve "The type x exists in both y and z"

$
0
0
I've just exported as package a scene from a Unity 2019.2.17f1 project and imported it in another Unity 2019.2.17f1 project and large number of scripts deliver the following error: Assets\Scripts\OpcUaComponents\OpcUaUtils.cs(76,16): error CS0433: The type 'NodeId' exists in both 'Opc.Ua.Core, Version=1.4.357.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8' and 'Opc.Ua.Core, Version=1.4.354.0, Culture=neutral, PublicKeyToken=null' A script looks like this: using Opc.Ua; using Opc.Ua.Client; using System.Collections.Generic; using UnityEngine; public class OpcUaUtils { private static ReferenceDescription[] ListChildren(Session session, NodeId parentNodeId) ... } I would appreciate any ideas how to solve this because the other already published sollutions for similar issues didn't work!

The type or namespace "Target" could not be found?

$
0
0
I'm getting this error message from this code: using UnityEngine; public class Gun : MonoBehaviour { public float damage = 10f; public float range = 100f; public Camera fpsCam; // Update is called once per frame void Update () { if (Input.GetButtonDown("Fire1")) { Shoot(); } } void Shoot() { RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) ; { Debug.Log(hit.transform.name); // This is where the error is Target target = hit.transform.GetComponent(); } } } I already made sure i didn't spell Target wrong. I also tried the stuff with moving scripts between folders, but it didn't work. Anyone know some other fix?

Namespaces that correspond to file location

$
0
0
I would like to use "namespaces that correspond to file location" rule for my Unity project, but I cannot think about subdirectory names.

For example, I am having this script in this directory hierachy:

Scripts->Patterns->Singleton->Singleton.cs

So the namespace according to the rule above will be Scripts.Patterns.Singleton

But it intersects with a script class name and this is not ok for me. How I can name subdirectory for Singleton.cs?

the type or namespace name "PostProcessingProfile" could not be found

$
0
0
sorry for the noob question but i get these errors with my script: The type or namespace name "PostProcessingProfile" could not be found The type or namespace name "PostProcessingBehaviour" could not be found and here is my script: using UnityEngine; using System.Collections; public class effecthealth : MonoBehaviour { public int maxHealth = 80; public int curHealth = 80; public int criticalHealth = 20; public PostProcessingProfile normalProfile; public PostProcessingProfile criticalProfile; PostProcessingBehaviour postProcess; void Awake() { postProcess = Camera.main.GetComponent(); } void Update() { postProcess.profile = (curHealth <= criticalHealth) ? criticalProfile : normalProfile; if (curHealth < 1) { Application.LoadLevel("1.7.1a"); } } void OnCollisionEnter(Collision col) { if (col.gameObject.tag == "enemybullet") { curHealth -= 20; Destroy(col.other); } } } could someone tell me what i am doing wrong? much appreciated

[resolved] Visual Studio does not find a namespace from the project

$
0
0
I am working on a project for quite some time and all of a sudden, the following error appeared in Visual Studio (Mac): The type or namespace name 'Pun' does not exists in the namespace 'Photon'. I checked that PhotonUnityNetworking is still where it is supposed to be (Photon.Chat and Photon.Realtime are still found). Visual Studio is up to date (8.5.4). Unity doesn't seem to have any such problems. The project is still built in the editor and behaves as expected. The namespace seems to just miss in Visual Studio. I have no idea what I did prior to losing the namespace.

How to write custom blocks/nodes for Unity VFX Graph?

$
0
0
Hey, as I haven't yet found any advice on how to do it, I decided to ask here: How can i add a custom Block or Node for the VFX Graph? If you just copy an existing .cs file to your assets and edit it, it's not working because of the protected namespace. If you copy it in the package folder, it's working but it will be deleted everytime you reopen the project. All i found regarding this issue is this : https://answers.unity.com/questions/1582260/visual-effects-graph-how-to-write-custom-vfx-block.html But the link in the answer isn't working anymore and i can't believe it's the only way. So i hope somebody can give me some advice on how to achieve this. Thanks.

Valve.VR or Valve.VR.InteractionSystem not found

$
0
0
Ive been having this error for few days, and i have no idea how to solve this. When i make new project and import SteamVR everything works great, until i want to make cript where i refference Valve.VR or Valve.VR.InteractionSystem namespace. I can only use Valve.Newtonsoft.Json. Any help would be really appreciated thx.

Errors with Unity Advertising after redownloading project and reenabling ads

$
0
0
Hello, I had to redownload my project after some changes that bugged my editor. After redownloading the project from Collab I had to re enable Ads in Services, which resulted in one of my scripts throwing these compiler errors: ---------- `Assets\Scripts\Ads\GiveReward.cs(19,57): error CS0433: The type 'ShowResult' exists in both 'UnityEngine.Advertisements.Editor, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Advertisements, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'` ---------- `Assets\Scripts\Ads\GiveReward.cs(6,42): error CS0535: 'GiveReward' does not implement interface member 'IUnityAdsListener.OnUnityAdsDidFinish(string, ShowResult)'` ---------- The second error is invalid as the GiveReward script does implement the IUnityAdsListener, since it worked before the redownload and the script is unchanged, but both Unity and Visual studio refuse to acknowledge that. Iam using Unity 2019.2.0f1 and Microsoft Visual Studio Community 2019 Version 16.5.1

two weird namespace errors

$
0
0
I have like 2 errors from unity that visual studio dont show and I dont know what is means. Please help me I am an idiot. script I used: `using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Security.Cryptography; using System.Threading; using UnityEngine; public float movement = 5f; public class movement : MonoBehaviour { // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { Vector3 movement = new Vector3(Input.getAxis("Horizontal"), 0f, 0f); transform.position += movement * Time.deltaTime*movement; } } void jump() { if (Input.GetButtonDown("Jump")) { gameObject.GetComponent().addForce(new Vector2(0f, 5f), forceMode2D.Impulse); }; }` errors from unity:Assets\movement.cs(10,14): error CS0116: A namespace cannot directly contain members such as fields or methods, Assets\movement.cs(28,6): error CS0116: A namespace cannot directly contain members such as fields or methods

Namespace references keep breaking in Visual Studio

$
0
0
Since updating Unity I am unable to compile the project code in Visual Studio. It still compiles and runs in the Unity Editor but Visual Studio gives hundreds of missing reference errors (*"The type or namespace name 'XXX' could not be found (are you missing a using directive or an assembly reference?)"*). This includes files which I wrote, i.e. my own created namespaces. Nothing I've tried works (see below) except for one thing. If I manually remove the references to all four assemblies in visual studio and re-add them, the solution will compile. But when I then close VS and reopen the same error comes up. The assemblies are Assembly-CSharp, Assembly-CSharp-Editor, Assembly-CSharp-Editor-firstpass and Assembly-CSharp-firstpass. The normal ones that get created as far as I know. Why does the reference break each time I restart VS? Versions: Unity 2019.3.12f1 Personal. Visual Studio Community 2017 15.9.22. I've tried: - all of these https://stackoverflow.com/questions/29962432/visual-studio-refuses-to-build-project-due-to-missing-assembly-reference-that-is - all of these https://stackoverflow.com/questions/450999/are-you-missing-an-assembly-reference-compile-error-visual-studio - Removing the .vs folder and all VS files from the Unity project folder and letting the editor regenerate them. Also regenerated manually from within unity - Making sure Visual Studio (and the Visual Studio Tools for Unity (which is installed using the Visual Studio installer)) are fully up to date. - Updated VS to the latest version - Removed VS Code package (I'm not using Code) from Unity, then readded. - A number of restarts of Unity and VS in between all the above.

Can't inherit from namespace

$
0
0
I am attempting to implement networking in my game with the use of Mirror. However, Unity is preventing me from using the package I just imported. Unity is telling me "the type of namespace 'Mirror' could not be found (are you missing a using directive or an assembly reference)". This same is said for inheriting NetworkBehavior. Here is the code that I have implemented so far. using System.Collections; using System.Collections.Generic; using UnityEngine; using Mirror; public class Player : NetworkBehavior { [SerializeField] private Vector3 movement = new Vector3(); private void Update() { myFunc(); } }

The type or namespace 'UI' does not exist in the namespace UnityEngine. But UI is present. Need help please,The type or namespace name 'UI' does not exist in the namespace UnityEngine. Need help please

$
0
0
I'm using Unity 2019.3.13 and Visual Studio Community Edition. This issue does not cause build or play errors. Just red squiggly lines that are annoying tbh. Not sure what the problem is. I've tried re-importing assets and the delete library solution. They don't work for me. I've installed an older version of Unity - 2019.3.0. Still the same issue. This is not specific to the UI namespace. Even the Advertisements namespace is not found. Interestingly, the UnityEngine.UI reference is present in the Solution Explorer.![alt text][1] ![alt text][2] Would really appreciate help with this issue. I've browsed several forums for answers but nothing has helped. Has been driving me crazy for days [1]: /storage/temp/159180-problem.png [2]: /storage/temp/159182-problem2.png

Namespace conventions for private developers (what to put instead of "company")

$
0
0
It's suggested to use the following scheme for namespace conventions:.(|)[.][.] [source][1] ---------- My question is: what to put instead of "company" when writing code as a private developer? Simply using initials (2 letters) could potentially lead to many collisions if everyone did it like that. ---------- Write the full name? There's still lots of people in the world who share the same name and even if not all of them are developers collisions could still happen. Plus, requiring users of my library to write "using PeterPan;" seems kinda awkward... [1]: https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/names-of-namespaces

using sinemachine.utility / using tmpro. error and problems.

$
0
0
hello all, my problem: i used cinemachine and setup a cinemachine brain and cinemachine virtual camera, along a target group, everything worked fine until i updated unity. now this was some time ago (1-2 months), after that the camera (text mesh pro to) keep working but i couldnt acces the namespace (using cinemachine/using tmpro) and if i went into the script it just showed a red line under it, and the code that i made (variables for example). so i tryid to fix it today, searched google and the forums, updated unity today, deleted cinemachine and tmpro and installed again, nothing worked, same problem, the camera still works, tmpro still works, but i cant acces anything in a script. btw im using (in case it helps): visual studio 2017, version 15.5.2, microsoft .NET framework version 4.7.02053 unity version 2019.2.0f1 ps: deleting cinemachine gives me the error (as expected): Assets\Player\Scripts\System\BirdEyeSC.cs(2,7): error CS0246: The type or namespace name 'Cinemachine' could not be found (are you missing a using directive or an assembly reference?)
Viewing all 398 articles
Browse latest View live


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