Помогите исправить ошибку. вот как она выглядит и скрин и код и текст ошибки.Незнаю как исправить помогите буду благодарен!
error CS0246: The type or namespace name ‘UnityStandartAssets’ could not be found (are you missing a using directive or an assembly reference?)
- c#
- android
- unity3d
задан 14 авг 2020 в 18:31
1
-
Ошибка гласит что библиотека под названием
UnityStandartAssets
не существует14 авг 2020 в 20:04
2 ответа
ответ дан 17 авг 2020 в 15:14
Правильно так: UnityStandardAssets
. Если что-то связано в скрипте с этим, то измени на название, которое я показал.
ответ дан 26 мар 2021 в 7:05
1
-
чем ваш ответ отличается от ответа, даного 17 авг ’20 в 15:14 (кроме того, что короче)?
26 мар 2021 в 7:57
I have SpatialAnchorConfig.cs at the path srcSpectatorView.UnityAssetsSpatialAlignment.ASAAzureSpatialAnchors.SDKScripts
However, get an error:
NullReferenceException: Object reference not set to an instance of an object
SpatialAnchorsUnityBuildProcessing.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at C:/sv/MixedReality-SpectatorView/src/SpectatorView.Unity/Assets/SpatialAlignment.ASA.Editor/Editor/SpatialAnchorsUnityBuildProcessing.cs:108)
UnityEditor.Build.BuildPipelineInterfaces+c__AnonStorey0.<>m__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:376)
UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List1[T] oneInterfaces, System.Action
1[T] invocationOne, System.Collections.Generic.List1[T] twoInterfaces, System.Action
1[T] invocationTwo, System.Boolean exitOnFailure) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:356)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
Всем привет, дамы и господа! Скопировал я значит код для сохранения данных с одного источника.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
public static class SaveLoad
{
public static List<Game> savedGames = new List<Game>();
//методы загрузки и сохранения статические, поэтому их можно вызвать откуда угодно
public static void Save()
{
SaveLoad.savedGames.Add(Game.current);
BinaryFormatter bf = new BinaryFormatter();
//Application.persistentDataPath это строка; выведите ее в логах и вы увидите расположение файла сохранений
FileStream file = File.Create (Application.persistentDataPath + "/savedGames.gd");
bf.Serialize(file, SaveLoad.savedGames);
file.Close();
}
public static void Load()
{
if(File.Exists(Application.persistentDataPath + "/savedGames.gd")) {
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Open(Application.persistentDataPath + "/savedGames.gd", FileMode.Open);
SaveLoad.savedGames = (List<Game>)bf.Deserialize(file);
file.Close();
}
}
}
Мне выдало ошибку
(10,24): error CS0246: The type or namespace name ‘Game’ could not be found (are you missing a using directive or an assembly reference?)
Честно, я вообще не понимаю сути. Сможете помочь?
I have two scripts, one is located at:
Assets / Scriptable Objects / …
while the other one is located at:
Assets / Scripts / …
I have the first script encapsulated on a namespace.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using VoidlessNodes.LevelFlowNodes;
namespace VoidlessUtilities
{
[CreateAssetMenu]
public class LevelFlowData : BaseNodeEditorData<BaseLevelNode, LevelFlowEditorAttributes>
{
private const string MENU_ITEM_PATH = "Create / ScriptableObjects / LevelFlowData";
private const string NEW_ASSET_PATH = "ScriptableObjects / Level Flow Data";
[SerializeField] private string _name;
private RootLevelNode _root;
/// <summary>Gets and Sets name property.</summary>
public string name
{
get { return _name; }
set { _name = value; }
}
/// <summary>Gets and Sets root property.</summary>
public RootLevelNode root
{
get { return _root; }
set { _root = value; }
}
[MenuItem(MENU_ITEM_PATH)]
public static void CreateAsset()
{
LevelFlowData scriptableObject = ScriptableObject.CreateInstance<LevelFlowData>() as LevelFlowData;
AssetDatabase.CreateAsset(scriptableObject, AssetDatabase.GenerateUniqueAssetPath(NEW_ASSET_PATH));
}
public BaseLevelFlowNode GetLevelFlow()
{
BaseLevelFlowNode rootLevelFlow = null;
if(root != null)
{
rootLevelFlow = root.GetNode();
}
else
{
Debug.LogError("[LevelFlowData] Data has no RootLevelFlowNode saved");
}
return rootLevelFlow as RootLevelFlowNode;
}
}
}
And the other one is using the same namespace, which is a namespace I use for my custom scripts, but the only difference is that LevelFlowData’s location is not under Scripts.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VoidlessUtilities;
public class TestLevelController : Singleton<TestLevelController>
{
[SerializeField] private LevelFlowData _levelFlowData;
[SerializeField] private List<GameObject> _testViews;
/// <summary>Gets and Sets levelFlowData property.</summary>
public LevelFlowData levelFlowData
{
get { return _levelFlowData; }
protected set { _levelFlowData = value; }
}
/// <summary>Gets and Sets testViews property.</summary>
public List<GameObject> testViews
{
get { return _testViews; }
set { _testViews = value; }
}
#region UnityMethods:
void OnEnable()
{
BaseInteractable.onTriggeredEvent += (int _eventID, bool _triggered)=> { Debug.Log("[TestLevelController] Event Triggered: " + _eventID); };
}
void OnDisable()
{
BaseInteractable.onTriggeredEvent -= (int _eventID, bool _triggered)=> { Debug.Log("[TestLevelController] Event Triggered: " + _eventID); };
}
/// <summary>TestLevelController's' instance initialization.</summary>
void Awake()
{
}
/// <summary>TestLevelController's starting actions before 1st Update frame.</summary>
void Start ()
{
}
/// <summary>TestLevelController's tick at each frame.</summary>
void Update ()
{
}
#endregion
#region PublicMethods:
public void EnableView(int _index)
{
testViews.SetAllActive(false);
testViews[_index].SetActive(true);
}
#endregion
#region PrivateMethods:
#endregion
}
Do I need to move LevelFlowData to Scripts, and make platform independet compilation (e.g., #if UNITY_EDITOR) encapsulation for UnityEditor namespace usage? Or is there another point I am missing?
This is the specific error log:
Assets/Scripts/Scene Controllers/TestLevelController.cs(10,27): error CS0246: The type or namespace name `LevelFlowData’ could not be found. Are you missing an assembly reference?
Thanks in advance.
Keywords: Unity, Solution for common issues
failed to open source file: ‘Packages/com.unity.render-pipelines.xxx’
Error at compiling assets:
Shader error in 'XXX': failed to open source file: 'Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl' at line 72 (on d3d11)
Reason:
Render pipelines were missed in project, e.g. you created a project using 3D
template.
Solution:
Create a project using LWRP
template or High Definition RP
template, these two templates provided new render pipelines.
Reference:
[LWRP] UPGRADING LWRP PACKAGE TO 7.0.0 BREAKS FORWARDRENDERDATA ASSET IN RESOURCE FILES
https://issuetracker.unity3d.com/issues/lwrp-upgrading-lwrp-package-to-7-dot-0-0-breaks-forwardrenderdata-asset-in-resource-files
Assets go pink
Issue:
Assets in scene go pink (purple).
Reason:
1, Materias and shaders of assets were missed.
2, Materias and shaders of assets using old render pipeline which not support in new verson.
Solution:
Retarget materias and shaders in meshes or update materials and shaders.
Reference:
everything became pink
https://answers.unity.com/questions/168624/everything-became-pink.html
Error CS0246: The type or namespace name ‘float2’ could not be found
Error at building project
error CS0246: The type or namespace name 'float2' could not be found (are you missing a using directive or an assembly reference?)
Caused by:
Missing requisite package.
Solution:
Install Mathematics: Windows -> Package Manager -> Select Mathematics
and click Install
.
An assembly with the same simple name ‘SyntaxTree.VisualStudio.Unity.Bridge’ has already been importe
Error log in editor console:
error CS1704: An assembly with the same simple name 'SyntaxTree.VisualStudio.Unity.Bridge' has already been imported. Try removing one of the references (e.g. 'D:Program_Filesx86Microsoft Visual Studio Tools for Unity16.0EditorSyntaxTree.VisualStudio.Unity.Bridge.dll') or sign them to enable side-by-side.
Error log on compiling project in Visual Studio:
error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine'
Solution:
- Close Editor and Visual Studio.
- Remove file
C:Program Files(x86)Microsoft Visual Studio Tools for Unity16.0EditorSyntaxTree.VisualStudio.Unity.Bridge.dll
. - Remove files
.sln
and.csproj
and remove directoriesLibrary
andobj
. - Reimport project and open Editor and Visual Studio.
It is not a lack of love, but a lack of friendship that makes unhappy marriages. ― Friedrich Nietzsche, Twilight of the Idols