Question by
polarbrainfreeze · Apr 21, 2019 at 07:27 PM ·
scripting problemspawning
Sprite renderers not rendering on Instatiated objects 2d
i am having a problem I Instatiate sprites in my scene but there not showing up in the game view this is the code
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class BasicAlien : MonoBehaviour {
public int moveDir;
public float alienSpeed;
public int range;
// Use this for initialization
void Start () {
moveDir = Random.Range(1, range);
}
// Update is called once per frame
void Update () {
switch(moveDir)
{
case 1:
transform.Translate(Vector3.right * alienSpeed * Time.deltaTime);
break;
case 2:
transform.Translate(Vector3.left * alienSpeed * Time.deltaTime);
break;
case 3:
transform.Translate(Vector3.down * alienSpeed * Time.deltaTime);
break;
case 4:
transform.Translate(Vector3.up * alienSpeed * Time.deltaTime);
break;
default:
transform.Translate(Vector3.up * alienSpeed * Time.deltaTime);
break;
}
moveDir = Random.Range(1, range);
}
} =================================================================================== please help.
Comment
you need to provide extra context or we wont be able to help you, since that code just moves the object nothing to do with sprites not showing
Your answer
Follow this Question
Related Questions
Checkpoint and Respawn 0 Answers
TD spawn more than one enemy 1 Answer
End Game (Stop spawning) with OnTriggerEnter or OnCollisionEnter? 0 Answers
Not sure what's wrong with the script 1 Answer
Object Pooling Spawn Script 1 Answer