Помогите исправить ошибку. вот как она выглядит и скрин и код и текст ошибки.Незнаю как исправить помогите буду благодарен!
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
Egor12 0 / 0 / 0 Регистрация: 18.01.2021 Сообщений: 20 |
||||
1 |
||||
18.01.2021, 14:23. Показов 50372. Ответов 16 Метки unity (Все метки)
Здраствуйте может кто то знает. Я создаю игру на движке unity и у меня ошибка CS0246 можете пожалуйста подсказать как её убрать? AssetsSpawner.cs(8,12): error CS0246: The type or namespace name ‘Gameobject’ could not be found (are you missing a using directive or an assembly reference?) вот такая ошибка.
0 |
Programming Эксперт 94731 / 64177 / 26122 Регистрация: 12.04.2006 Сообщений: 116,782 |
18.01.2021, 14:23 |
Ответы с готовыми решениями: Как убрать ошибку Как убрать ошибку? Как убрать ошибку? Программа переводит два заданных числа из… ошибка CS0246 в проекте как исправить? 16 |
109 / 81 / 37 Регистрация: 13.01.2016 Сообщений: 395 |
|
18.01.2021, 16:50 |
2 |
Строка 8. GameObject. Вторая часть типа тоже с большой буквы
1 |
0 / 0 / 0 Регистрация: 18.01.2021 Сообщений: 20 |
|
18.01.2021, 16:58 [ТС] |
3 |
Огромное спасибо но теперь ошибка
0 |
74 / 53 / 24 Регистрация: 19.10.2012 Сообщений: 212 |
|
18.01.2021, 18:10 |
4 |
speed += spawner.speedIncrease * Time.deltaTime; Убери spawner speed += speedIncrease * Time.deltaTime; Добавлено через 28 секунд
1 |
250 / 186 / 68 Регистрация: 04.03.2019 Сообщений: 1,010 |
|
18.01.2021, 18:16 |
5 |
spawner.speedIncreas Spawner с большой буквы.
1 |
Egor12 0 / 0 / 0 Регистрация: 18.01.2021 Сообщений: 20 |
||||
18.01.2021, 21:29 [ТС] |
6 |
|||
Спасибо большое, но у меня появилась ещё одна ошибка AssetsDownMover.cs(24,23): error CS1061: ‘Transform’ does not contain a definition for ‘postition’ and no accessible extension method ‘postition’ accepting a first argument of type ‘Transform’ could be found (are you missing a using directive or an assembly reference?) что то я так понимаю с ‘Transform’ не так. буду очень благодарен за помощь.
0 |
74 / 53 / 24 Регистрация: 19.10.2012 Сообщений: 212 |
|
18.01.2021, 21:40 |
7 |
Во первых у тебя с верху написана ошибка. ее в переводчик. Instantiate(Blocklines[rand], transform.postition, Quaternion.identity); все красное ошибки твоего кода. Миниатюры
0 |
0 / 0 / 0 Регистрация: 18.01.2021 Сообщений: 20 |
|
18.01.2021, 22:02 [ТС] |
8 |
Спасибо мне 12 только учусь поэтому у меня столько ошибок ) 2 первые ошибки я уже исправил. А там где postition его просто удалить ? Я не настраивал visual studio под unity потому что не знал что это нужно делать, и не знаю как.
0 |
74 / 53 / 24 Регистрация: 19.10.2012 Сообщений: 212 |
|
18.01.2021, 22:26 |
9 |
Ну Youtube в помощь. Я тоже начал примерно в этом возрасте. Очень давно.
0 |
0 / 0 / 0 Регистрация: 18.01.2021 Сообщений: 20 |
|
18.01.2021, 22:51 [ТС] |
10 |
Спасибо понял. Так всё таки postition убрать из скрипта ?
0 |
74 / 53 / 24 Регистрация: 19.10.2012 Сообщений: 212 |
|
18.01.2021, 23:41 |
11 |
Решение
Так всё таки postition убрать из скрипта ? написано с ошибкой просто. Добавлено через 4 минуты
0 |
0 / 0 / 0 Регистрация: 18.01.2021 Сообщений: 20 |
|
19.01.2021, 10:59 [ТС] |
12 |
Хорошо огромное спасибо ))
0 |
0 / 0 / 0 Регистрация: 18.01.2021 Сообщений: 20 |
|
20.01.2021, 14:28 [ТС] |
13 |
Почему-то speedIncrease работает то есть скорость становиться больше со временем, а Spawner не работает он не спавнит BlockLines.
0 |
Eli_To4Ka 0 / 0 / 0 Регистрация: 23.11.2021 Сообщений: 1 |
||||
23.11.2021, 12:37 |
14 |
|||
Ночью сидел писал код, по примеру ютубера… у него все работает у меня нет… cs0246 ошибку выбивает.
0 |
559 / 361 / 206 Регистрация: 18.10.2019 Сообщений: 1,217 |
|
23.11.2021, 14:13 |
15 |
Eli_To4Ka, interactactable. Правильно — interactable.
0 |
Sovock 0 / 0 / 0 Регистрация: 06.02.2022 Сообщений: 1 |
||||
06.02.2022, 16:13 |
16 |
|||
Делал год из интеренета, всё сделал как на ролике, но появляется ошибка: (AssetsscriptsMovePlayer.cs(49,20): error CS1061: ‘Rigidbody’ does not contain a definition for ‘AddForse’ and no accessible extension method ‘AddForse’ accepting a first argument of type ‘Rigidbody’ could be found (are you missing a using directive or an assembly reference?) вот код:
0 |
559 / 361 / 206 Регистрация: 18.10.2019 Сообщений: 1,217 |
|
06.02.2022, 16:18 |
17 |
Sovock, метод правильно называется AddForce
0 |
Всем привет, дамы и господа! Скопировал я значит код для сохранения данных с одного источника.
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?)
Честно, я вообще не понимаю сути. Сможете помочь?
Go to unity
r/unity
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
This community is being built to help users of all levels gain access to resources, information, and support from other users in regards to anything Unity. You can showcase your work and use this forum to connect with others sharing the same passions.
Post away!
Members
Online
•
How do I fix error CS0246?
For example I have errors like these:
LibraryPackageCachecom.unity.timeline@1.6.4RuntimeTrackAsset.cs(799,132): error CS0246: The type or namespace name ‘RuntimeElement‘ could not be found (are you missing a using directive or an assembly reference?)
LibraryPackageCachecom.unity.timeline@1.6.4RuntimeEventsSignalsSignalEmitter.cs(18,34): error CS0246: The type or namespace name ‘Marker‘ could not be found (are you missing a using directive or an assembly reference?)
LibraryPackageCachecom.unity.2d.spriteshape@7.0.4RuntimeSpriteShapeGenerator.cs(19,6): error CS0246: The type or namespace name ‘BurstCompileAttribute‘ could not be found (are you missing a using directive or an assembly reference?)
I have not modified or created any files. I just created a new project and then bunch of these kind of error messages showed up.
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.