#stuck

1 messages · Page 1 of 1 (latest)

rapid orchid
#

i was following bracky first video of unity and got stuck i followed the instructions but can,t seem to understand the probelm

unique forgeBOT
#

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!

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.

rapid orchid
#

can someone other than bot help

naive sparrow
#

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

rapid orchid
#

ok

#

the public rigid body is gving the problem

rapid orchid
rotund fossil
#

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.

olive glacier
#

ohh i know

#

you put the public rigid body outside the class

#

let me explain

near hare
#

pblic rigid body should be inside the brackets

#

learn c# before using unity

olive glacier
#

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)

rapid orchid
#

Oh I solved problem

#

But thank you for helping

rapid orchid
near hare
#

ok dw

random loom
dapper scroll
random loom
dapper scroll
#

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, ...

random loom
#

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.

olive glacier