VERY Strange rb2d.velocity issue
Hello, I'm having a strange issue with my instantiated prefab's change in velocity.
I have a prefab that instantiates as usual, and when it becomes instantiated the velocity of this prefab (ball) is supposed to change. The code is extremely simple, here it is.
Rigidbody2D rb2d;
// Use this for initialization
void Start () {
rb2d = gameObject.GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update () {
rb2d.velocity = new Vector3(5, 10, 0);
}
Now here's the thing; the ball didn't move at all on the x-coordinate plane UNTIL it left the camera's view (the y velocity worked perfectly). I wondered if this was a coincidence to a different problem, so I changed the y position to spawn the ball at a lower position. Still, the second the ball was out of the camera's view the x velocity worked fine.
This is definitely a peculiar problem that I couldn't even begin to explain. If anyone has ever seen a problem like this before, I would be super thankful if you helped me with this one.
Thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220612110502im_/https://answers.unity.com/themes/thub/images/avi.jpg)