Author Topic: spawning sprites issue  (Read 2387 times)

mansquatch

  • Guest
spawning sprites issue
« on: October 10, 2013, 10:02:02 AM »
First off, I am fairly new to NGUI. So, I am trying to spawn some sprites from prefabs..

Here is that block of code:
  1. int rand = Random.Range(1, numItemsToSpawn) - 1; // Offset for zero-based array.
  2. string s = arrObjects[rand];
  3. GameObject temp = (GameObject) Resources.Load(s);
  4. GameObject newObj = NGUITools.AddChild(isoCamMain.gameObject, temp) as GameObject;

The isoCamMain is my UI Camera instance. Is this the right object to spawn an object in to? If I try spawning it on an empty game object then the sprite is super huge. Ideally, I would like to have the instance spawn attached to my spawner object (empty gameobject).

Also, I want to position the spawned sprite off the top of the screen and have the sprite "fall" slowly down screen (ala Tetris) but I am having an issue with the positioning of the spawn sprite. Any help would be great.
« Last Edit: October 10, 2013, 10:33:37 AM by mansquatch »

mansquatch

  • Guest
Re: spawning sprites issue
« Reply #1 on: October 10, 2013, 11:01:03 AM »
Figured it out. Carry on. These are not the droids you are looking for...