#stuck
1 messages · Page 1 of 1 (latest)
Learn C# basics before starting with Unity!
Learning the syntax of C# definitely helps when using Unity. Here are some links to get you started!
- https://docs.microsoft.com/en-us/dotnet/csharp/ (Microsoft's Getting Started Guide on C#)
- https://learn.microsoft.com/en-gb/shows/csharp-fundamentals-for-absolute-beginners/ (Teaches you the C# fundamentals)
- https://github.com/ossu/computer-science (Not strictly C#, a general open-source education in Computer Science)
- https://www.classcentral.com/report/stanford-on-campus-courses (Publicly available Computer Science courses from Stanford)
- https://codecademy.com/learn/learn-c-sharp (Code Academy course on C#)
Most programming problems come from not knowing how to use the language - if you haven’t programmed much or you’re not confident about the OOP concepts in your mind, it's useful to understand these before diving into the engine.
can someone other than bot help
You have to explain more detailed
Where you are stuck
The bot has been called by a user of this discord
It basically tells you to send your code and explain your problem
It seems you forgot or deleted the {} brackets
But you have to send all your code tho
i hope you can help
Straight answer will be: That you are missing some symbols in statements, as shown in the error. Now as the first reply mentions, you should look into learning basics of C# and coding first to get familiar with all these. It will be helpful in long run.
so c# itself is an extremely complicated language. you can't just start coding without a lot of work. that is because it is an Object Oriented Language (OOP). What is is an OOP? you may ask. well, it is a form of language where you create an Object class and add different attributes to it like functions or variables (which here are called methods and fields). let me give you an example. let's say you were making a dog. A dog has different data about it that you need to know then, like its cuteness, its breed etc. You would also need to give it some stuff to do like bark or jump. C# code works the same way here you make an object(the public class thing you see on top) and add different methods and fields to it. that is why you can't just write C# code without a platform. you can't have data about an object without something to process that data. Unity knows that so when we make a script it makes a special class object based on the stuff you have to do. Here you put the public Rigidbody outside the {} brackets, right below the line defining the class. the {} brackets tell you what is inside that object or function or anything. so now you are diffing an attribute to nothing. you can't add an attribute to nothing thus it is showing an error. just putt it in the {} brackets like
using UnityEngine;
public class pm : MonoBehaviour
{
public Rigidbody rb;
// Start is called before the first frame update
void Start()
{
Debug.Log("Hello");
}
// Update is called once per frame
void Update()
{
}
}
it will work as now you are no longer applying an attribute to nothing (beware that this is an oversimplification of how thing work)
I learn basics I just made a mistake
ok dw
C# is ”extremely complicated”? Isn’t that a bit exaggerated?
I feel like it is exaggerated. But then again, they are entitled to that opinion.
However, whether it's good to introduce it to a beginner blatantly like this, is a different question...
Yeah… That’s what I was thinking.
Honestly, compared with low-level languages, C# is very nice and easy.
It has very clear syntax, no real need to worry about memory management, a metric ton of syntactic sugar, ...
Agreed. Although I don’t have much experience with other programming langauges, excluding some python, I’d say c# syntax seems more clear than most.
by "extremlt complicated" i mean't it works differently compared to other languages and can get a bit hard to understand at times