Move from point A to point B, then destroy? ( java S)

Hi, I got two empty game object called A and B respectively, and a cube. How to i make a cube move from A to B upon instantiation and destroy itself after the moving part is done? Is it possible to use Transform.translate in this case? Thanks!

2 Answers

2

http://www.unifycommunity.com/wiki/index.php?title=MoveObject

var pointA : Transform;
var pointB : Transform;
var moveSpeed = 1.0;

function Start () {
    yield MoveObject.use.Translation (transform, pointA.position, pointB.position, moveSpeed, MoveType.Speed);
    Destroy (gameObject);
}

There is something wrong with ur script Eric5h5. I don’t know why but I’m getting an error.
It says “unknown identifier: MoveObject” at 6,11.
How can I fix it?

There's nothing wrong with that code. Did you follow that link he also posted there? You can't just copypasta this stuff! You also need to be using that script, which is on the wiki.