- Home /
snake game tail problems
For the first tail piece its worked fine, but the other tail pieces are not working , they are not following the snake they are going down the floor.
I figured out one problem for this behavior, for the first piece instance in the inspector view the target is set to snakehead and for the second piece instance the target name in the inspector is set to
pieces,but not piece, it should be piece
function addPiece () {
var newPiece : GameObject = Instantiate(piece, transform.position+Vector3(9, 0.5, 9), Quaternion.identity);
newPiece.name = "Piece";
newPiece.GetComponent.<SmoothFollow>().target = lastPiece;
lastPiece = piece; }
the target name is pieces........can any one help me out in this problem
one more thing to add for the above,I have used #pragma strict to check......got some error:BCE0022: Cannot convert 'UnityEngine.Object' to 'UnityEngine.GameObject',
Your answer
Follow this Question
Related Questions
I want to respawn the food everytime the snake collides with it 0 Answers
Instantiate a object after destroying a instantiated object. 1 Answer
Checking if object intersects? 1 Answer
How to Instantiate only once? 2 Answers
How to instantiate different prefab on the end of a chain of prefabs? 2 Answers