hi everyone!
i have this problem… i want to change a value on a prefab that spawns every 2 seconds.
but i dont know how!
the prefab is called Plane with a C# script called Obsticle
Obsticle Script:
using UnityEngine;
public class Obstacle : MonoBehaviour
{
public Vector2 velocity = new Vector2(-4, 0);
public float range = 4;
// Use this for initialization
void Start()
{
rigidbody2D.velocity = velocity;
transform.position = new Vector3(transform.position.x, transform.position.y - range * Random.value, transform.position.z);
}
}
i know i spelled the script name wrong, but im too lazy to care
so what i want is to change the velocoty value on the sript from my player script witch is on a gamobject in the game.
is that posseable at all?