Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
C#
using UnityEngine;

public class playermovement : MonoBehaviour
 {

    public Rigidbody rb;

    // Start is called before the first frame update
    void Start ()
    {
        rb.AddForce(0, 200, 500);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}


What I have tried:

I tried to make a unity game, please help
Posted
Updated 16-Mar-21 5:53am
v2
Comments
SeanChupas 16-Mar-21 10:25am    
That game is not going to do much at all. Did you have a question?

Do yourself a favour and find a tutorial on Unity - and before that C# if you haven't already1 - Welcome to Unity Learn[^] may be a good start, I haven't tried it myself.

Writing a game2 that would interest a four year old for more than twenty seconds (including load time) is not trivial, and you do need to know what you are doing or you will very quickly get frustrated.



1 You need to get the C# language basics and the mindset of "how to code" down pat first, or Unity will just confuse and depress you.
2 Or any other form of software, come to that.
 
Share this answer
 
You need to get a handle on the rigid body before you use it;

C#
void Start ()
{
    rb = GetComponent<Rigidbody>();
    rb.AddForce(0, 200, 500);
}


As said though, you really need to go through some tutorials for Unity and c#, it's quite a steep learning curve.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900