Novice learning Unity USES, I'm doing a small 2 d mobile practice, I made a three-story building, let objects on each floor are moving back and forth, I let him move on the first floor, left and right sides put two empty object, and then use the following code,
Public Transform [] target;
Int target0=0;
Void the Update ()
{
If (Vector3. Short (the transform localPosition, target [target0] position) & lt;=0.1 f)
{
If (target0 & gt;
=1){
Target0=0;
}
Else if (target0 & lt;=0)
{
Target0 + +;
}
}
The else
{
Transform. The position=Vector3. MoveTowards (transform localPosition, target [target0] localPosition, m_speed * Time deltaTime);
}
}
It's online reference himself to others, I want to put multiple target objects, each floor has two let him can move in each floor all around oneself, how to do? Ask thigh to help me