How to make my character to fly upwards without limit as for example game pou, subway that ran without limits
//use Rigidbody.velocity if 2d Rigidbody2d.velocity and this script from my 2d game :
using UnityEngine;
using System.Collections;
public class Mover : MonoBehaviour
{
private float movspeed = 8f;
void FixedUpdate ()
{
rigidbody2D.velocity = new Vector2 (movspeed ,rigidbody2D.velocity.y); // in this line movspeed is the x value of the rigidbody and it will always go to the right in speed of 8.
}
}
I think the best way to do this is to make an “Object Pooling”.
What this basically means is that you have a spawner above the screen which will instantiate new objects at random, BUT what is coll with object pooling is that when the objects leaves under the screen it gets disabled, so that you can transform this same object again later on the spawner (Without instantiating a new object, so that you don’t have too many instantiated objects getting your game slower and slower).
Search for object pooling and you shall find a lot of examples!
Here are some links you can start looking:
http://jessefreeman.com/dev-diary/simple-pooling-gameobjects-unity/
https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/object-pooling