- Home /
found the answer myself
no errors but unable to instantiate sprite in 2D space
any help for this simple problem? i have spent hours trying to figure it out with to no avail. (im using 2D settings for my project).
no errors thrown
Rainbow1 is a sprite
Rainbow1 is inside resource folder
the empty gameobject "end" has a transform of 0,0,0 as does its parent
the camera z axis is properly adjusted
have tried casting to gameobject and spawning as gameobject but does not work
even though no errors are thrown, the instantiated object does not appear in the hierarchy during play.
using UnityEngine;
using System.Collections;
public class SpawnStuff : MonoBehaviour {
public Transform end;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
StartCoroutine (SpawnWaves ());
}
IEnumerator SpawnWaves(){
Instantiate(Resources.Load("rainbow1"), end.position, end.rotation) ;
yield return new WaitForSeconds (3);
}
}
Follow this Question
Related Questions
sprite animation not playings 0 Answers
sliced sprite taking part of one above it 1 Answer
Transparency Sort Axis on Y with Pivot instead of Center of object? 1 Answer
If I use Sprite Atlas, will the images that are part of the atlas still be included in build? 1 Answer
Sprites Become Invisible (SOLVED) 4 Answers