Keep getting Error CS0131
Here's my script... I tried evrything but this still pops up...
using UnityEngine; using System.Collections;
public class Laser : MonoBehaviour { public float speed;
void start ()
{
GetComponent<Rigidbody>.Velocity() = transform.forward * speed;
}
}
Answer by hexagonius · Nov 22, 2016 at 08:33 PM
velocity is a property and not a method. remove braces and write it lower case.
Okay, I did what you said, and now I have error code 0119. Again, here's my script using UnityEngine; using System.Collections;
public class Laser : $$anonymous$$onoBehaviour
{
public float speed;
void start ()
{
GetComponent<Rigidbody>.velocity= transform.forward * speed;
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612101206im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Sphere with AddForce or Velocity not moving 1 Answer
Float speed not getting updated on FixedUpdate nor Updated and OnAnimatorMove 1 Answer
Rigidbody. Acceleration of free falling object works bad 0 Answers
Keep gravity while adding velocity to a Rigidbody? 1 Answer
C# keep previous velocity while jumping, previous solutions not working 0 Answers