Hi everyone i’m new to Unity scripting and i cant deal with the problem please someone help me
here is the code:
using UnityEngine;
using System.Collections;
public class testScript : MonoBehaviour
{
int i = 1;
// Use this for initialization
void Start()
{
for (i = 1; i > 6; i++)
{
Debug.Log("value of i = " + i);
}
Debug.Log("i'm out of the loop");
} //the problem is cs1513 c# expected unity here(21.line)
// Update is called once per frame
void Update()
{
}
program i’m using Microsoft Visual Studio
Thanks in advance!!!
Programmer
119k21 gold badges231 silver badges318 bronze badges
asked Aug 10, 2016 at 5:30
You only missing }
at the end of the script. The last }
should close the class {
. This was likely deleted by you by mistake. Sometimes, Unity does not recognize script change. If this problem is still there after making this modification, simply close and re-open Unity and Visual Studio/MonoDevelop.
using UnityEngine;
using System.Collections;
public class testScript : MonoBehaviour
{
int i = 1;
// Use this for initialization
void Start()
{
for (i = 1; i > 6; i++)
{
Debug.Log("value of i = " + i);
}
Debug.Log("i'm out of the loop");
} //the problem is cs1513 c# expected unity here(21.line)
// Update is called once per frame
void Update()
{
}
}//<====This you missed.
answered Aug 10, 2016 at 5:35
ProgrammerProgrammer
119k21 gold badges231 silver badges318 bronze badges
0
C++ Error 1513-1514
Всем привет, я новичок как в Unity так и в C++.
Прошу вашей помощи, импортировал ассет на что Unity пожаловался на скрипт, многие ошибки устранил но вот две ошибки не получается, вот эти «error CS1514: { expected и error CS1513: } expected»
Вот сам скрипт:
Используется csharp
using UnityEngine;
using CharacterMotor;
public class CharacterMotor;
public class StepsHandlerExample : MonoBehaviour
{
private CharacterMotor charMot;
private Vector3 displacement;
private float iniBackSpeed;
private float iniForSpeed;
private float iniSideSpeed;
private Vector3 lastPos;
private float slowBackSpeed;
private float slowForSpeed;
private float slowSideSpeed;
public float slowWalkVolume = 0.1f;
private bool onetime;
public float normalWalkRate = 0.7f;
public float slowWalkRate = 1.5f;
private void Start()
{
lastPos = transform.position;
charMot = GetComponent<CharacterMotor>();
iniForSpeed = charMot.movement.maxForwardSpeed;
iniBackSpeed = charMot.movement.maxBackwardsSpeed;
iniSideSpeed = charMot.movement.maxSidewaysSpeed;
slowBackSpeed = charMot.movement.maxBackwardsSpeed — 6.0f;
slowForSpeed = charMot.movement.maxForwardSpeed — 7.0f;
slowSideSpeed = charMot.movement.maxSidewaysSpeed — 5.0f;
}
private void Update()
{
if (Input.GetKey(KeyCode.LeftShift))
{
GetComponent<AudioSource>().volume = slowWalkVolume;
charMot.movement.maxForwardSpeed = slowForSpeed;
charMot.movement.maxBackwardsSpeed = slowBackSpeed;
charMot.movement.maxSidewaysSpeed = slowSideSpeed;
if (onetime)
{
onetime = false;
CancelInvoke(«NormalWalk»);
InvokeRepeating(«NormalWalk», 0f, slowWalkRate);
}
}
else
{
GetComponent<AudioSource>().volume = 1f;
charMot.movement.maxForwardSpeed = iniForSpeed;
charMot.movement.maxBackwardsSpeed = iniBackSpeed;
charMot.movement.maxSidewaysSpeed = iniSideSpeed;
if (!onetime)
{
onetime = true;
CancelInvoke(«NormalWalk»);
InvokeRepeating(«NormalWalk», 0f, normalWalkRate);
}
}
}
private void NormalWalk()
{
displacement = transform.position — lastPos;
lastPos = transform.position;
if (!charMot.IsJumping())
{
if (displacement.magnitude > 0.01)
{
if (!GetComponent<AudioSource>().isPlaying)
{
GetComponent<AudioSource>().Play();
}
}
}
}
private void OnGUI()
{
GUI.Box(new Rect(Screen.width/12, Screen.height — (Screen.height/4), Screen.width/1.1f, Screen.height/5),
«Hold Left Shift to walk slowly without noise! see the difference if you run behind the enemy!»);
}
}
Заранее всем спасибо большое.
- Shram
- UNец
- Сообщения: 5
- Зарегистрирован: 04 мар 2019, 14:02
Re: C++ Error 1513-1514
1max1 04 мар 2019, 15:16
Как насчет сходить уроки по с# почитать, глядишь сможешь отличать его от c++. К тому же, если ты и дальше планируешь развиваться, то код писать нужно в нормальной среде типа Visual Studio, которая будет подчеркивать строки с ошибками.
Что по твоему должна делать эта строка в твоем коде?
Используется csharp
public class CharacterMotor;
Конечно же ты не знаешь, потому что код-то не твой, ты его от куда-то взял в надежде на чудо, а разбираться не захотел
-
1max1 - Адепт
- Сообщения: 5285
- Зарегистрирован: 28 июн 2017, 10:51
Re: C++ Error 1513-1514
Friend123 04 мар 2019, 17:09
1max1, улыбнул )))))
-
Friend123 - Старожил
- Сообщения: 701
- Зарегистрирован: 26 фев 2012, 22:12
- Откуда: Тверь
-
- ICQ
Re: C++ Error 1513-1514
Shram 04 мар 2019, 18:32
1max1 писал(а):Как насчет сходить уроки по с# почитать, глядишь сможешь отличать его от c++. К тому же, если ты и дальше планируешь развиваться, то код писать нужно в нормальной среде типа Visual Studio, которая будет подчеркивать строки с ошибками.
Что по твоему должна делать эта строка в твоем коде?Используется csharp
public class CharacterMotor;
Конечно же ты не знаешь, потому что код-то не твой, ты его от куда-то взял в надежде на чудо, а разбираться не захотел
Конечно не мой умник, читай внимательно ! Написано же что был импортирован ассет и было около 6-и ошибок, они ссылались на «CharacterMotor»
а когда я кидаю другой скрипт «CharacterMotor» тогда появдяется другая ошибка, «The type or namespace name ‘ParticleAnimator’ could not be found (are you missing a using directive or an assembly reference?»
Затем пришел к этим единственным ошибкам.
Но я вижу здесь все злые.
- Shram
- UNец
- Сообщения: 5
- Зарегистрирован: 04 мар 2019, 14:02
Re: C++ Error 1513-1514
Friend123 04 мар 2019, 18:37
Shram писал(а):Но я вижу здесь все злые.
Это не мы злые, это вы, простите, задаете вопросы уровня 1 курса универа по программированию
Вот, если выдает ошибку, то в самой ошибке всегда сказано что не так, они все типовые. Простое гугление даст ответ в 10 раз быстрее, чем писать на форуме.
P.S. Как-то я думал всегда, что форумы для обсуждения сложных проблем. Ошибался видать.
-
Friend123 - Старожил
- Сообщения: 701
- Зарегистрирован: 26 фев 2012, 22:12
- Откуда: Тверь
-
- ICQ
Re: C++ Error 1513-1514
Shram 04 мар 2019, 18:47
Friend123 писал(а):
Shram писал(а):Но я вижу здесь все злые.
Это не мы злые, это вы, простите, задаете вопросы уровня 1 курса универа по программированию
Вот, если выдает ошибку, то в самой ошибке всегда сказано что не так, они все типовые. Простое гугление даст ответ в 10 раз быстрее, чем писать на форуме.
P.S. Как-то я думал всегда, что форумы для обсуждения сложных проблем. Ошибался видать.
P.S. а я думал почемучка для этого и была создана.
Ну хорошо, смотрите я создал новый проект импортировал ассет, на что он мне ответил ошибкой вот такую
«StepsHandlerExample.cs(5,13): error CS0246: The type or namespace name ‘CharacterMotor’ could not be found (are you missing a using directive or an assembly reference?»
И поверьте я пользовался «Google» проверил имя скрипта «CharacterMotor» совпадает, Google не чего не нашел.
- Shram
- UNец
- Сообщения: 5
- Зарегистрирован: 04 мар 2019, 14:02
Re: C++ Error 1513-1514
1max1 04 мар 2019, 19:40
Похоже автор твоего ассета забыл добавить скрипт CharacterMotor))
И поверьте я пользовался «Google» проверил имя скрипта «CharacterMotor» совпадает, Google не чего не нашел.
Что-то я тебе не верю)))
http://wiki.unity3d.com/index.php/CharacterMotor
-
1max1 - Адепт
- Сообщения: 5285
- Зарегистрирован: 28 июн 2017, 10:51
Re: C++ Error 1513-1514
Shram 04 мар 2019, 19:57
1max1 писал(а):Похоже автор твоего ассета забыл добавить скрипт CharacterMotor))
И поверьте я пользовался «Google» проверил имя скрипта «CharacterMotor» совпадает, Google не чего не нашел.
Что-то я тебе не верю)))
http://wiki.unity3d.com/index.php/CharacterMotor
Этот скрипт я находил и добавлял, но все же спасибо, но теперь вылезли еще ошибки, суть их схожая
«The type or namespace name ‘ParticleAnimator’ could not be found (are you missing a using directive or an assembly reference?»
Теперь я понял что значит Не удалось найти ссылка на сборку, нет тупа скрипта, я ведь правельно все понял ? Значит уже два скрипта он забыл положить ?
- Shram
- UNец
- Сообщения: 5
- Зарегистрирован: 04 мар 2019, 14:02
Re: C++ Error 1513-1514
Shram 04 мар 2019, 20:36
Ну да точно, ассет требует версию 4.6 теперь все понял.
Спасибо большое, вот теперь есть не большой как в скриптах так и в юнити.
- Shram
- UNец
- Сообщения: 5
- Зарегистрирован: 04 мар 2019, 14:02
Вернуться в Почемучка
Кто сейчас на конференции
Сейчас этот форум просматривают: Google [Bot] и гости: 31
StAsIk2008 0 / 0 / 0 Регистрация: 20.02.2020 Сообщений: 1 |
||||
1 |
||||
20.02.2020, 13:09. Показов 12911. Ответов 3 Метки нет (Все метки)
вот скрипт
__________________
0 |
управление сложностью 1687 / 1300 / 259 Регистрация: 22.03.2015 Сообщений: 7,545 Записей в блоге: 5 |
|
20.02.2020, 13:38 |
2 |
Пропущена закрывающая скобка, либо лишняя открывающая
0 |
11 / 9 / 8 Регистрация: 08.05.2013 Сообщений: 139 |
|
20.02.2020, 14:55 |
3 |
На какую строку ругается?
0 |
0 / 0 / 0 Регистрация: 17.02.2020 Сообщений: 87 |
|
24.02.2020, 11:53 |
4 |
В конец поставь знак }
0 |
So I’ve been making a save/load script for my Unity project, and it looks like this (please don’t copy):
using UnityEngine;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System;
using System.Runtime.Serialization;
using System.Reflection;
// Made By Wasabi.
// === This is the info container class ===
[Serializable ()]
public class SaveData : ISerializable {
// === Values ===
public bool foundKeyCard1 = false;
public bool foundKeyCard2 = false;
public bool foundKeyCard3 = false;
public bool foundKeyCard4 = false;
public bool foundKeyCard5 = false;
public bool foundKeyCard6 = false;
public bool foundKeyCard7 = false;
public bool foundKeyCard8 = false;
public bool foundKeyCard9 = false;
public bool foundKeyCard10 = false;
public bool foundCarKeys1 = false;
public float expscore = 0;
public int levelReached = 1;
// === /Values ===
public SaveData () {}
public SaveData (SerializationInfo info, StreamingContext ctxt)
{
foundKeyCard1 = (bool)info.GetValue("foundKeyCard1", typeof(bool));
foundKeyCard2 = (bool)info.GetValue("foundKeyCard2", typeof(bool));
foundKeyCard3 = (bool)info.GetValue("foundKeyCard3", typeof(bool));
foundKeyCard4 = (bool)info.GetValue("foundKeyCard4", typeof(bool));
foundKeyCard5 = (bool)info.GetValue("foundKeyCard5", typeof(bool));
foundKeyCard6 = (bool)info.GetValue("foundKeyCard6", typeof(bool));
foundKeyCard7 = (bool)info.GetValue("foundKeyCard7", typeof(bool));
foundKeyCard8 = (bool)info.GetValue("foundKeyCard8", typeof(bool));
foundKeyCard9 = (bool)info.GetValue("foundKeyCard9", typeof(bool));
foundKeyCard10 = (bool)info.GetValue("foundKeyCard10", typeof(bool));
foundCarKeys1 = (bool)info.GetValue("foundCarKeys1", typeof(bool));
expscore = (float)info.GetValue("expscore", typeof(float));
levelReached = (int)info.GetValue("levelReached", typeof(int));
}
public void GetObjectData (SerializationInfo info, StreamingContext ctxt)
{
info.AddValue("foundKeyCard1", (foundKeyCard1));
info.AddValue("foundKeyCard2", (foundKeyCard2));
info.AddValue("foundKeyCard3", (foundKeyCard3));
info.AddValue("foundKeyCard4", (foundKeyCard4));
info.AddValue("foundKeyCard5", (foundKeyCard5));
info.AddValue("foundKeyCard6", (foundKeyCard6));
info.AddValue("foundKeyCard7", (foundKeyCard7));
info.AddValue("foundKeyCard8", (foundKeyCard8));
info.AddValue("foundKeyCard9", (foundKeyCard9));
info.AddValue("foundKeyCard10", (foundKeyCard10));
info.AddValue("foundCarKeys1", (foundCarKeys1));
info.AddValue("expscore", expscore);
info.AddValue("levelReached", levelReached);
}
}
// === This is the class that will be accessed from scripts ===
public class SaveLoad {
public static string currentFilePath = "SaveData.cjc";
public static void Save () // Overloaded
{
Save (currentFilePath);
}
public static void Save (string filePath)
{
SaveData data = new SaveData ();
Stream stream = File.Open(filePath, FileMode.Create);
BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Binder = new VersionDeserializationBinder();
bformatter.Serialize(stream, data);
stream.Close();
}
public static void Load () { Load(currentFilePath); } // Overloaded
public static void Load (string filePath)
{
SaveData data = new SaveData ();
Stream stream = File.Open(filePath, FileMode.Open);
BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Binder = new VersionDeserializationBinder();
data = (SaveData)bformatter.Deserialize(stream);
stream.Close();
}
}
// === This is required to guarantee a fixed serialization assembly name, which Unity likes to randomize on each compile
// Do not change this
public sealed class VersionDeserializationBinder : SerializationBinder
{
public override Type BindToType( string assemblyName, string typeName )
{
if ( !string.IsNullOrEmpty( assemblyName ) && !string.IsNullOrEmpty( typeName ) )
{
Type typeToDeserialize = null;
assemblyName = Assembly.GetExecutingAssembly().FullName;
// The following line of code returns the type.
typeToDeserialize = Type.GetType( String.Format( "{0}, {1}", typeName, assemblyName ) );
return typeToDeserialize;
}
return null;
}
}
And I think that’s it. The CS1513 isn’t in there. If you spot any errors, please let me know. But the problem is in this other script I’m making that autosaves when I close the application. It looks like this (Please don’t copy):
using UnityEngine; // For Debug.Log, etc.
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System;
using System.Runtime.Serialization;
using System.Reflection;
// Made by Wasabi.
void OnApplicationQuit()
{
public class SaveLoad {
public static string currentFilePath = "SaveData.cjc";
public static void Save () // Overloaded
{
Save (currentFilePath);
}
public static void Save (string filePath)
{
SaveData data = new SaveData ();
Stream stream = File.Open(filePath,
FileMode.Create);
BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Binder = new
VersionDeserializationBinder();
bformatter.Serialize(stream, data);
stream.Close();
}
}
}
Now I know the code under void OnApplicationQuit()
is supposed to be my save routine. Well I’m not exactly sure what part of my save script is my save routine. So If you could help me with that, feel free to examine my save/load script and tell me what is my actual save routine. But anyways, it keeps on telling me «Error, «}» expected (11,7) CS1513.» and I check my script. I’ve read another post and the answer was that the error meant that I had forgotten a closing «}» at the end f my script. Well it seems as though that is not true in my case, because it is not missing any «}». I even tried adding an extra «}» at the end, and yet it still said the same thing. So it only clears the error when I put another «}» directly after the opening «{» after
void OnApplicationQuit()
which doesn’t make any sense. But when I do, it then says another error at
void OnApplicationQuit()
(to be specific: the beginning of OnApplicationQuit()
of void OnApplicationQuit()
) and that I can’t use methods or functions for that namespace, which I don’t know what that means, and I don’t think that’s true. I believe that the second error is only triggered because I had to put void OnApplicationQuit() {}
. What is going on here and how in the world do I fix it? Another thing: I constructed my Save/Load script after researching on how to do that, but how does the code know when I collect a keycard1? Do I have to make a script in the keycard1 that tells the Save/Load script when I collect it? And will this result in me having to add more scripts in the Save/Load script to detect the keycard1 script telling the Save/Load script that I picked it up? I’m still new to the whole C# part of Unity and I’m entirely self-taught. You see, I’m just beginning to make my first serious project. So I need to know what exactly are the save and load routines in my save/load script that I use to call save and load; because I need to make a menu screen with buttons that when pressed, call the save or load routine. So when I press he Save or Load button(s), looking at my script, will the Script know that I have the KeyCard, or will I have to manually put that into the script? And lastly, how do I make a script that calls a save when I obtain, say, KeyCard2?
Sincerely,
Wasabi.
So I’ve been making a save/load script for my Unity project, and it looks like this (please don’t copy):
using UnityEngine;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System;
using System.Runtime.Serialization;
using System.Reflection;
// Made By Wasabi.
// === This is the info container class ===
[Serializable ()]
public class SaveData : ISerializable {
// === Values ===
public bool foundKeyCard1 = false;
public bool foundKeyCard2 = false;
public bool foundKeyCard3 = false;
public bool foundKeyCard4 = false;
public bool foundKeyCard5 = false;
public bool foundKeyCard6 = false;
public bool foundKeyCard7 = false;
public bool foundKeyCard8 = false;
public bool foundKeyCard9 = false;
public bool foundKeyCard10 = false;
public bool foundCarKeys1 = false;
public float expscore = 0;
public int levelReached = 1;
// === /Values ===
public SaveData () {}
public SaveData (SerializationInfo info, StreamingContext ctxt)
{
foundKeyCard1 = (bool)info.GetValue("foundKeyCard1", typeof(bool));
foundKeyCard2 = (bool)info.GetValue("foundKeyCard2", typeof(bool));
foundKeyCard3 = (bool)info.GetValue("foundKeyCard3", typeof(bool));
foundKeyCard4 = (bool)info.GetValue("foundKeyCard4", typeof(bool));
foundKeyCard5 = (bool)info.GetValue("foundKeyCard5", typeof(bool));
foundKeyCard6 = (bool)info.GetValue("foundKeyCard6", typeof(bool));
foundKeyCard7 = (bool)info.GetValue("foundKeyCard7", typeof(bool));
foundKeyCard8 = (bool)info.GetValue("foundKeyCard8", typeof(bool));
foundKeyCard9 = (bool)info.GetValue("foundKeyCard9", typeof(bool));
foundKeyCard10 = (bool)info.GetValue("foundKeyCard10", typeof(bool));
foundCarKeys1 = (bool)info.GetValue("foundCarKeys1", typeof(bool));
expscore = (float)info.GetValue("expscore", typeof(float));
levelReached = (int)info.GetValue("levelReached", typeof(int));
}
public void GetObjectData (SerializationInfo info, StreamingContext ctxt)
{
info.AddValue("foundKeyCard1", (foundKeyCard1));
info.AddValue("foundKeyCard2", (foundKeyCard2));
info.AddValue("foundKeyCard3", (foundKeyCard3));
info.AddValue("foundKeyCard4", (foundKeyCard4));
info.AddValue("foundKeyCard5", (foundKeyCard5));
info.AddValue("foundKeyCard6", (foundKeyCard6));
info.AddValue("foundKeyCard7", (foundKeyCard7));
info.AddValue("foundKeyCard8", (foundKeyCard8));
info.AddValue("foundKeyCard9", (foundKeyCard9));
info.AddValue("foundKeyCard10", (foundKeyCard10));
info.AddValue("foundCarKeys1", (foundCarKeys1));
info.AddValue("expscore", expscore);
info.AddValue("levelReached", levelReached);
}
}
// === This is the class that will be accessed from scripts ===
public class SaveLoad {
public static string currentFilePath = "SaveData.cjc";
public static void Save () // Overloaded
{
Save (currentFilePath);
}
public static void Save (string filePath)
{
SaveData data = new SaveData ();
Stream stream = File.Open(filePath, FileMode.Create);
BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Binder = new VersionDeserializationBinder();
bformatter.Serialize(stream, data);
stream.Close();
}
public static void Load () { Load(currentFilePath); } // Overloaded
public static void Load (string filePath)
{
SaveData data = new SaveData ();
Stream stream = File.Open(filePath, FileMode.Open);
BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Binder = new VersionDeserializationBinder();
data = (SaveData)bformatter.Deserialize(stream);
stream.Close();
}
}
// === This is required to guarantee a fixed serialization assembly name, which Unity likes to randomize on each compile
// Do not change this
public sealed class VersionDeserializationBinder : SerializationBinder
{
public override Type BindToType( string assemblyName, string typeName )
{
if ( !string.IsNullOrEmpty( assemblyName ) && !string.IsNullOrEmpty( typeName ) )
{
Type typeToDeserialize = null;
assemblyName = Assembly.GetExecutingAssembly().FullName;
// The following line of code returns the type.
typeToDeserialize = Type.GetType( String.Format( "{0}, {1}", typeName, assemblyName ) );
return typeToDeserialize;
}
return null;
}
}
And I think that’s it. The CS1513 isn’t in there. If you spot any errors, please let me know. But the problem is in this other script I’m making that autosaves when I close the application. It looks like this (Please don’t copy):
using UnityEngine; // For Debug.Log, etc.
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System;
using System.Runtime.Serialization;
using System.Reflection;
// Made by Wasabi.
void OnApplicationQuit()
{
public class SaveLoad {
public static string currentFilePath = "SaveData.cjc";
public static void Save () // Overloaded
{
Save (currentFilePath);
}
public static void Save (string filePath)
{
SaveData data = new SaveData ();
Stream stream = File.Open(filePath,
FileMode.Create);
BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Binder = new
VersionDeserializationBinder();
bformatter.Serialize(stream, data);
stream.Close();
}
}
}
Now I know the code under void OnApplicationQuit()
is supposed to be my save routine. Well I’m not exactly sure what part of my save script is my save routine. So If you could help me with that, feel free to examine my save/load script and tell me what is my actual save routine. But anyways, it keeps on telling me «Error, «}» expected (11,7) CS1513.» and I check my script. I’ve read another post and the answer was that the error meant that I had forgotten a closing «}» at the end f my script. Well it seems as though that is not true in my case, because it is not missing any «}». I even tried adding an extra «}» at the end, and yet it still said the same thing. So it only clears the error when I put another «}» directly after the opening «{» after
void OnApplicationQuit()
which doesn’t make any sense. But when I do, it then says another error at
void OnApplicationQuit()
(to be specific: the beginning of OnApplicationQuit()
of void OnApplicationQuit()
) and that I can’t use methods or functions for that namespace, which I don’t know what that means, and I don’t think that’s true. I believe that the second error is only triggered because I had to put void OnApplicationQuit() {}
. What is going on here and how in the world do I fix it? Another thing: I constructed my Save/Load script after researching on how to do that, but how does the code know when I collect a keycard1? Do I have to make a script in the keycard1 that tells the Save/Load script when I collect it? And will this result in me having to add more scripts in the Save/Load script to detect the keycard1 script telling the Save/Load script that I picked it up? I’m still new to the whole C# part of Unity and I’m entirely self-taught. You see, I’m just beginning to make my first serious project. So I need to know what exactly are the save and load routines in my save/load script that I use to call save and load; because I need to make a menu screen with buttons that when pressed, call the save or load routine. So when I press he Save or Load button(s), looking at my script, will the Script know that I have the KeyCard, or will I have to manually put that into the script? And lastly, how do I make a script that calls a save when I obtain, say, KeyCard2?
Sincerely,
Wasabi.
I was programming (C#) a day/night cycle system for my unity game when I got the following error:AssetsScriptsRotate.cs(15,6): error CS1513: } expected
My code should calculate a ‘time’ in minutes from the rotation of the sun (Which is attached to this object).
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Rotate : MonoBehaviour
{
public float timescale=1f;
private int hour=12;
private int minute=0;
void Start()
{
StartCoroutine("TickUpdate");
}
public IEnumerator TickUpdate()
{
private string stringbuffer1;
for(;;)
{
private float RotationSpeed 0.0025*timescale
gameObject.transform.Rotate(RotationSpeed,0f,0f);
public float RawMinute=0.00694444444444444444444444444444f*(gameObject.transform.rotation.x-90);
public string time="{hour}:{minute}";
yield return new WaitForSeconds(.01f);
}
}
}
I already checked multiple sites and the unity answers form.
Any help would be appericiated.
(I’m using Notepad++ as my editor)