Hello,
I’ve been digging around in the site’s past posts for an issue I have with what I believe the version changes with C# in the following step of the Space Shooter Tutorial:
- Creating Shots : Game Setup, Player and Camera - Unity Learn
I’d made it to the last step of the tutorial where you test the bolts firing by entering the Game view
and then dragging the PreFab
item bolt into the Hierarchy
. The expectation was that the bolt should fire forward at a speed of 20. Unfortunately that is not the case. When I drag it into the hierarchy it just sits in place taking no action what so ever.
Here is the code that I’m using in my Mover.cs
file from the tutorial:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Mover : MonoBehaviour
{
public Rigidbody rb;
public float speed;
void start ()
{
rb = GetComponent<Rigidbody> ();
rb.velocity = transform.forward * speed;
}
}
Any suggestions? I know the tutorials have depreciated to new code at this point, but I believe I’m doing this correctly yet no luck.
Thanks in advance.