Sprite not appearing using SpriteManager

So now that I started using sprite manager to manage my game objects, I can’t get the sprite to appear on the game object.

Here’s a little background,…I use a game controller object to spawn the game object, and then assign a variety of properties to that game object:

newShip = GameObject.Find("EnemySpawn");
			
// SPAWN A SHIP SPRITE OBJECT
var instantiatedKamikazeSprite : GameObject = Instantiate (kamikazeSprite, newShip.transform.position, newShip.transform.rotation);



// set its attack target
var iKamikazeTarget : KamikazeShip = instantiatedKamikazeSprite.GetComponent(KamikazeShip);

iKamikazeTarget.myAttackTarget = myAttackTarget;
			
// set its spriteman
iKamikazeTarget.spriteMan = spriteMan;

// set its parent
			instantiatedKamikazeSprite.transform.parent = myParent.transform;

Then in the actual spawned object, I tell it to set its sprite (so that the actual object can remove the sprite when it’s time for it to be destroyed…

var spriteMan : SpriteManager;
var kSprite : Sprite;

function Start(){
	
kSprite = spriteMan.AddSprite(gameObject, 3, 3, 1, 1, 512, 512, true);

When I run all this stuff, the game object spawns fine (I can tell because it’s got some particles on it), but the sprite never shows up on screen.

any suggestions?

I see you are using billboarding, so the sprite should always be facing the camera, so that wouldn’t be the problem.

Verify the material you’re using is actually pointing to the correct texture. And make sure the SpriteManager object is positioned at the origin (0,0,0). If that’s off, it can offset all your sprites, possibly making it so you couldn’t see them.

Download the demo package in the SpriteManager thread and look at how everything is being done there - that should give you something to go off of. I’ll reply again if I think of any other possible pitfalls.

For the time being, however, if you aren’t using SpriteManager’s animation features, you can get the same drawcall reduction benefits now with Unity’s new automatic dynamic batching, where meshes with the same material get combined into a single drawcall, much like SpriteManager.

Is there something you have to do to turn on automatic batching? I didn’t see much of a performance increase when I switched to 1.5.

One other question I had…I’m wondering if I’m referencing the object correctly. How do you reference the game object a script is attached to? I was using gameObject, but I don’t know if that’s correct.

and, btw, the sprite thing works when I tried it in my test script like this:

var spriteMan : SpriteManager;
var spriteShip : GameObject;
//var test : Sprite;

@System.NonSerialized
var spawnPoint : GameObject;
@System.NonSerialized var instantiatedShip : GameObject;

function Update () {
	

}

function Start(){
	
	spawnPoint = GameObject.Find("EnemySpawn");
	CreateShip();
	//CreateSprites();
}
function CreateShip(){
	

	instantiatedShip = Instantiate(spriteShip, spawnPoint.transform.position, spawnPoint.transform.rotation);
	var test : Sprite = spriteMan.AddSprite(instantiatedShip, 3, 3, 1, 1, 512, 512, true);	
	

	
}

No, you don’t have to turn it on, it’s automatic. You won’t notice any improvement, however, if you aren’t already using a lot of draw calls (30 or so).

Yes, if you’re “inside” a script attached to a GameObject, then just using “gameObject” will work. At least it does in C#, so I’m assuming it would in JS as well.