using UnityEngine;
using System.Collections;
public class RandomMinorities : MonoBehaviour {
public GameObject speedBoost;
public GameObject moneyCoin;
void Awake() {
GameObject.Instantiate(speedBoost, new Vector2(0, 0), Quaternion.identity);
}
}
This very basic script doesn’t work as it should. I placed Prefab as speedBoost. Prefab has image in it, it’s a retro-coin downloaded from internet. But it only says “missing sprite”, as soon as I point it, I need to put it on layer higher than 10. Prefab already has image, can’t I make script inherit it? Also, how do I change layer of order of an object?
So, as soon as I point it to image AGAIN and I set it on layer more than 10. Then it’s visible.
Yes, it is, both image and prefab are in folder Asset.
As I mentioned, yes, if you re-point the image to the Instantiated object, and set layer to higher than a certain amount (it’s around 10, then it’s visible).
We all know the date, unfortunately we don’t know what issue you’re referring to. Someone had a problem in 2015, it doesn’t mean there’s a bug in Unity.
Talking about 2015, please don’t necro posts, especially for unhelpful comments like this.
I had the Similar “Issue”, cause I tried changed order of layers multiple times (Even On Run Time). But found “Solution”, Dumb me forgot that I had the Element in the child while I was just changing parent’s Order.