Hi i'm relatively new to unity and programing so sry if it's a noobish question
I'm trying to change randomly the color of an animatedSprite wich is itself instantiate a certain number of time. So i have an array of color and pick up one randomly, but the abimatedSprite appear to be all transparent, without color in the viewport when i it play. But if i choose one color like animatedSprite.color = Color.green it's working.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class spawnEnemy : MonoBehaviour
{
public tk2dAnimatedSprite enemy;
public Color[] colorChoices;
public GameObject road;
public List<Transform> spawnPoint;
private tk2dAnimatedSprite target;
private int n = 0;
private int p = 0;
private Vector3 pos = new Vector3();
void Start()
{
p = Random.Range(0, colorChoices.Length);
n = Random.Range(0, spawnPoint.Count);
target = (tk2dAnimatedSprite)Instantiate(enemy, spawnPoint[n].transform.position, enemy.transform.rotation);
target.color = colorChoices[p];
target.transform.parent = road.transform;
pos = road.transform.position;
}}