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

Type or namespace of certain packages could not be found after unity testing framework was set up

$
0
0
As the title suggests, types or namespace of certain Unity3D packages can no longer be found after the Unity3D testing framework has been set up. We've set up the framework exactly according to the documentation of Unity3D and double-checked it several times. Especially the new input system and addressables are concerned in our case. Has anyone of you experienced the same problem? (Unity3D version: 2019.4.12f1) We've also tried this [solution][1] mentioned on StackOverflow without any success. [1]: https://stackoverflow.com/questions/50223866/how-to-set-up-unit-tests-in-unity-and-fix-missing-assembly-reference-error?noredirect=1

I can't access a script in another script because of namespace

$
0
0
I'm pretty sure this is a bug but here's a shorted version of my code: This is the script where I want the bool to be in: namespace UnityStandardAssets.Characters.FirstPerson { public class FirstPersonController : MonoBehaviour { private Camera m_Camera; private bool isReload; private GameObject PlayerCamera; private void Start() { m_Camera = Camera.main; PlayerCamera = GameObject.Find("PlayerCamera"); isReload = PlayerCamera.GetComponent().isReloading; } } This is the Script where the bool comes from: public class GunScript : MonoBehaviour { public bool isReloading; } obviously this is not all the code, but this is the part with the problem. Now my Visual Studio says that > Error CS0246 The type or namespace name "GunScript" could not be found (a using directive or assembly reference may be missing) and I don't understand why I can't access it. The charactercontroller and other components get accessed without problems but my own Scripts don't work. I included "m_Camera" because that's the GameObject where my GunScript is on, and I first tried: isReload = m_Camera.GetComponent().Reloading; and I had the same issue Update: After trying to fix the issue a bit more, I think it definetly is because of the namespace used. How should I get the bool else? I don't want to redo my whole reloading logic in the player movement script.

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?

Why is "using YamlDotNet.Core.Tokens;" in one of my scripts?..

$
0
0
Hello I just stumbled upon an unexpected build error, and when I looked into it I found this extremely strange namespace reference, namely YamlDotNet.Core.Tokens. I looked it up and found what the package is, but I never used or downloaded it. That script was a very basic script I had created (and then discarded soon because of choosing to use Bolt for this very simple project). I am 100% sure I did not write that line of code at the beginning of the script. Does anyone have any idea what this could be? Is it possible that I imported something into my project that does that whenever a new script is created? If I create a script now, that doesn't happen.

Game Foundation: C# "using" namespace error

$
0
0
Hi! I'm trying out Game Foundation and I want to save all the changes that are made in Runtime. So I found this code in the official tutorial: using UnityEngine; using UnityEngine.GameFoundation; public class SaveGame : MonoBehaviour { IDataPersistence localPersistence; void Awake() { // choose what format you want to use JsonDataSerializer dataSerializer = new JsonDataSerializer(); // choose where and how the data is stored localPersistence = new LocalPersistence(dataSerializer); // tell Game Foundation to initialize using this // persistence system. Only call Initialize once per session. GameFoundation.Initialize(localPersistence); } public void Save() { GameFoundation.Save(localPersistence); } public void Load() { GameFoundation.Load(localPersistence); } } But I'm having this problem: ![alt text][1] [1]: /storage/temp/172228-безымянныи.png Any help will be appreciated!

HDRP namespacing for editing Volume at runtime?

$
0
0
Has anyone had luck editing the environment features of HDRP with C#?
I installed a fresh HDRP project with example files in version 2020.1.11f1. The 'High Definition RP' package is 8.2.0.
I'm trying to add a script that edits a **Volume** class property via C# at runtime, but the class isn't found.
I've tried to include: using UnityEngine.Rendering.HighDefinition; But I get the error The type or namespace name 'HighDefinition' does not exist in the namespace 'UnityEngine.Rendering' I've also tried: using UnityEngine.Experimental.Rendering.HDPipeline; But I get The type or namespace name 'HDPipeline' does not exist in the namespace 'UnityEngine.Experimental.Rendering' How would one find out what namespace I need to use to edit environment features of HDRP ?

How to import project 1 to another project , with same name of script with unique namespaces and different root folder?

$
0
0
Hello Everyone, My Issue is: My packages are created with different root names with unique namespaces, scripts are located in different subfolders, but during import, all moved to the Scripts of the first one package. can you please help me how to solve this issue? Thanks, Assets/Project1/Script1.cs -// with I have adding namespace namespace_proj1{ } and second one is, Assets/Project2/Script1.cs -// with I have adding namespace namespace_proj2{ } Please help me,

NameSpace in Embedded package does not create .dll

$
0
0
Recently I want to move URP as an embedded package in order to modify it conveniently . But when I create a test script i found that vscode shows can not find my custom namespace ,but it still can run in Engine and without Error Log in Engine, then I find it does not generate .dll and .csproj of my custom namespace ,i guess this is why vscode can not recognized it. I wonder if there is a way to resolve this problem ? I have **regenerate project file** for many times. ![alt text][1] [1]: /storage/temp/173101-indra.png

137 NameSpace Errors on my first project

$
0
0
This is my first unity project so I'm sorry is this is a bad question. So I'm trying to test out my character controller and unity won't start up due to compile errors. I have 137 error that are all related to namespace. One for example says `Library\PackageCache\com.unity.package-manager-ui@2.0.13\Editor\AssemblyInfo.cs(7,12): error CS0246: The type or namespace name 'UxmlNamespacePrefixAttribute' could not be found (are you missing a using directive or an assembly reference?) ` All of them seem to be located in my package manager, and I have touched the any of the c# code for anything so far. I think it's related to the assets I've imported but I'm not sure what I may have done wrong. Any help is welcomed, because I'm worried ill have to start over from scratch again.

Add to a namespace but dont clear all the everything in that namespace

$
0
0
I will like to add my own class to unity editor namespace but it just clear all the other class and voids so I want to know a way to This won't work Namespace UnityEditor { public static class myclass { Public static void myvoid() { //code } } } Sorry for the bad code. I just type it in fast

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

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 ---------- **UPDATE** Managed to fix the errors by using the Reimport All option. This however broke the ads completely as now they do work in Editor but not on my Android phone. ---------- **UPDATE 2** I wrote an email to Unity Ads support, according to them I had a duplicate Unity Ads SDK package installed. They replied earlier today with a fix that worked perfectly. ---------- **HOW TO FIX** --------------

'

I was told this fix by Unity Ads support.

'

**1. Remove the Ads SDK from Package Manager**> Unity editor > Window > Package> Manager > Uninstall Advertisement> package **2. Disable Ads Service** > Unity editor > Window > General >> Services > Turn Ads service as OFF **3. Restart Unity Editor and download the newest Ads SDK from Asset Store** > Restart Unity editor > Window > Asset> Store > Search and import "Unity> Monetization"

'

After that I tried to build an APK and it worked perfectly on my Android phone.

A big thank you to the support team.

Type or namespace not found for Asset Store packages on Linux

$
0
0
System: Ubuntu 20.04 When cloning my project and opening it on a Linux PC, I get type or namespace not found error. This does not happen on Windows. The specific assets where that happens are SteamVR, Wwise for Unity and Json.NET I found nothing regarding this issue online **EDIT :** Ok so basically custom assembly definition files don't work on Unity Linux 2020.3.1f2, any idea on how to fix them ?

Issues with namespaces and folder structure

$
0
0
I'm having a seemingling elementary issue regarding namespaces that I've been struggling with. I've installed both the CorgiEngine package as well as the PhotonEngine package. Both have their own namespaces (MoreMountains.CorgiEngine and Photon.Pun etc). I've been mostly working in the corgi engine namespace up until now, and now I'm attempting to merge my Photon multiplayer setup with my game. _ So, when I'm editing one of my CorgiEngine scripts, and attempting to add Photon functionality through (using Photon;) visual studio isn't recognizing the reference. If I make a script in Assets/Scripts and try to use (using Photon;) it DOES recognize the reference. In my research and troubleshooting this obviously seems like a heirarchy problem. I've seen suggestions to put them in the Asset/Plugins folder, so that they compile earlier, but this didn't work for me. _ What am I missing? How do I reference Photon.Pun while working on my MoreMountains.CorgiEngine scripts?

unable to load unity namespace

$
0
0
last week i moving from using visual studio to vsCode (because tabNine), and i already go to edit =>prefab=>external ide, i also already download the extension![alt text][1] but it cant load UnityEnggine namespace. i dint move the file or anything, just normal script like usual. but vsCode didnot reconize like, transform, texture, gameObject, and all tha unnity namspace have. so how do i fix this? [1]: /storage/temp/179806-e.png

Has anyone been able to connect Unity to Microsoft's Flight simulator using simconnect?

$
0
0
I am trying to get basic information from the MSFS 2020 simulator but Unity does not recognise the simconnect.dll in the assets folder. When adding "using Microsoft.FlightSimulator.SimConnect;" to the script I get a message, "The type or namespace name 'FlightSimulator' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)". Has anyone connected successfully? Is there a basic setting I'm missing? Thanks for any guidance as the Microsoft and Unity forum entries and documents so far have not been helpful. Thanks a lot.

How to get started with Azure Blobg Storage? (How to I add the correct namespace?)

$
0
0
Hey all, Trying to implement the ability to upload blobs from my Unity project to Azure Blob storage at runtime. However, after installing the NuGet Azure.storage.blobs package Unity couldn't "Find the namespace". So, I tried downloading the NuGet packages directly from nuget.org and extracting the .net DLL's as per this guide: [MSDN Reference][1]. However, After bringing the netstandard2.0/Azure.Storage.Blobs.dll file I am informed about dependancy issues. I chase these dependancies until I've included the following in the plugins folder: Azure.Core.DLL Azure.Storage.Blobs.DLL Azure.Storage.Common.DLL System.Memory.Data.DLL However, upon hitting play I get the following list of errors: ![alt text][2] I've highlighted on of the DLL errors to show that I have an entire list of dependancies that are missing. How should I proceed? Should I simply keep downloading these dependancies (and their dependancies, and their dependancies ad infinitum) until the errors stop, or is there some other method that I'm missing that I should simply use? All replies appreciated. XD Please Note: I'm using .NET 4.x in the player settings. [1]: https://docs.microsoft.com/en-us/visualstudio/gamedev/unity/unity-scripting-upgrade [2]: /storage/temp/180558-unityerror.png

Need help with namespace error

$
0
0
I installed a package from the NuGet package installer and the compiler says it's in my references as the IntelliSense autocomplete "OpenQA.Selenium", but I keep getting a namespace error in unity but not in the compiler. Thanks for the help! ![alt text][1] ![alt text][2] [1]: /storage/temp/182024-1.png [2]: /storage/temp/182025-2.png

Where is namespace UnityEngine.Video?

$
0
0
My Project vers "2020.1.17f1" Visual Studio "2017" I will make DLL File and Add reference UnityEngine & UnityEngine.UI but I could not found VideoPlayer!! did not found using UnityEngine.Video How i can find that namespace UnityEngine.Video? ![alt text][1] [1]: /storage/temp/183354-unityenginevideo.png

The type or namespace name 'StateMachine' could not be found (are you missing a using directive or an assembly reference?)

$
0
0
I'm getting this issue in Unity even though I've already created the class StateMachine. Here are the scripts in question. The error appears regarding this script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class TestEnemy : MonoBehaviour { [SerializeField] private float turnAngle; [SerializeField] private float turnRange; private float viewAngle; private float viewDistance; private float speed; private float hunger; private float hungerSpeed; private float maxHealth; private List predators; private List machineStates; private StateMachine testMachine; public float health; // Start is called before the first frame update void Start() { GenerateMachine(); testMachine.Start(); //testIdle = new IdleMovement("Idle Movement", null); turnRange = 10f; } // Update is called once per frame void Update() { turnAngle = Random.Range(-turnRange, turnRange) * Mathf.PerlinNoise(Time.deltaTime, 0); testMachine.Update(); } void GenerateMachine() { IdleMovement testIdle = new IdleMovement("Test Idle", null, gameObject.transform, turnAngle); machineStates.Add(testIdle); testMachine = new StateMachine(machineStates); } } in the same folder, I have the following script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class StateMachine { public List machineStates; public State runningState; public StateMachine(List machineStates) { this.machineStates = machineStates; } public void Start() { StartingRunningState(); } public void Update() { runningState.Update(); EvaluateNextState(); } public void StartingRunningState() { foreach (State state in machineStates) { if (state.nodeStatus == NodeStatus.RUNNING) { runningState = state; } } } protected void EvaluateNextState() { foreach (State nextState in runningState.possibleStates) { if (nextState.nodeStatus == NodeStatus.SUCCESS && nextState.priority > runningState.priority) { runningState = nextState; } } } public void StateDebug() { string CurrentRunningState() { return runningState.nodeName; } string NextPossibleStates() { string nextPossibleStates = ""; for (int i = 0; i < runningState.possibleStates.Count; i++) { if (i == 0) { nextPossibleStates += runningState.possibleStates[i]; } else { nextPossibleStates += ", " + runningState.possibleStates[i]; } } return nextPossibleStates; } } } Please help I don't understand why I'm getting this issue :(
Viewing all 398 articles
Browse latest View live


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