Answer the question
In order to leave comments, you need to log in
Where is the error in the movement of the object?
The script hangs on Canvas:
public class Test2 : Test1
{
private GameObject inst;
protected GameObject GO;
private static Vector2 destination;
public static Vector2 Destination
{
get { return destination; }
set
{
destination = value;
}
}
void Start()
{
GO = Resources.Load("W11", typeof (GameObject)) as GameObject;
destination = RandomVector2(destination);
Init();
}
public void Init()
{
inst = Instantiate(GO, destination, Quaternion.identity) as GameObject;
inst.transform.SetParent(Canvas.transform, false);
inst.transform.position = destination;
StartCoroutine(TCoroutine()); //выставляет новое значение destination
}
}
public class Update1 : MonoBehaviour
{
void Update()
{
transform.position = Vector2.Lerp(transform.position, Test2.Destination, Test1.speed* Time.deltaTime);
}
}
void Update()
{
inst.transform.position = Vector2.Lerp(transform.position, destination, Test1.speed* Time.deltaTime);
}
Answer the question
In order to leave comments, you need to log in
Cool, two questions
1. Why are you opening the input file as "wb"? Do you write something in it?
2. Where in your code will the file be deleted? I don't see such a line. Or do I look bad?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question