//class name - Vectors()
#pragma strict
var target : Rigidbody;
private var Dir : Vector3;
Dir = transform.position;
private var px : Vector3= Vector3(2,2,2);
function Update ()
{
if(Input.GetMouseButtonDown(0))
{
Dir.y = target.position.y + px.y;
target.position = Dir;
}
if(Input.GetMouseButtonDown(1))
{
Dir.y = target.position.y - px.y;
target.position = Dir;
}
}
//class name - SimpleMovement_circular
#pragma strict
private var z: float;
private var y :float;
var x : float = 5;
private var PosRef : Vectors = new Vectors();
var target : Rigidbody;
var rotationSpeed : float;
private var i : int = x;
function Awake()
{
}
function Update ()
{
for(i=0 ; i<x ; i++)
{
y = Mathf.Lerp( 0+i , i+1 , rotationSpeed*Time.deltaTime);
z = Mathf.Lerp( 0+i , i+1 , rotationSpeed*Time.deltaTime);
}
}
warning shown for the second script —
You are trying to create a MonoBehaviour using the ‘new’ keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
UnityEngine.MonoBehaviour:.ctor()
Vectors:.ctor() (at Assets/Scripts/Vectors.js:1)
what could possibly be the problem and hoe could i create a reference to the script named Vectors In the other script…could the reference be setup in the awake or the start functions.