Correct Way of using Sprite Manager and arraylists

Ok, I’m sorry if this has been asked before. I saw there are other sprite manager posts, but I didn’t find anything to my issue, which is as follows:

  1. I wanted to use sprite manager to place light glows into the scene, it’ll be both static and moving ones which are attached to creatures and the player.

Here’s the code I’m curious about:

So, this one is fine.
private void AddGlow(Vector3 position) {
GameObject tempGO = (GameObject)Instantiate(lightGlow, position, Quaternion.identity) as GameObject;
glowSprites.Add(spriteManager.AddSprite((GameObject)tempGO, 1f, 1f, 0, 0, 256,256,false));
glows.Add(tempGO);
}

and the function above is run in start, to populate the two arrays.
void Start()
{
for(int i = 0;i<numSprites;i++)
{
** AddGlow(new Vector3(-10+i,3,2));**
}
}

So, here is the update function :

void Update()
{
** for(int i = 0;i<numSprites;i++)**
** {**
** GameObject TempObj = new GameObject();**
__ TempObj = (GameObject)glows*;__
__
TempObj.transform.position = new Vector3(Random.Range(-10,10),2,Random.Range(-10,10));__
__
}*__

* for(int i = 0;i<numSprites;i++)*
* {*
_ spriteManager.Transform((Sprite)glowSprites*);
}
}
[/B]
-----
So, the example above works, but is that how I should use sprite manager? It seems somehow cumbersome having to maintain two Arraylists like that.
And also, I was not able to modify the values directly inside the arraylist, but I had to create a temporary gameobject first. Is that the only way to modify gameobject stored in a list? I could not access the properties if not.
What I would like to do is this:_
__glows.transform.position = new Vector3(1,2,3);[/B]
but what I had to do is this:__

GameObject TempObj = new GameObject();
__TempObj = (GameObject)glows;*

TempObj.transform.position = new Vector3(1,2,3);[/B]
So, I just wanted to know if this is the correct way of using spritemanager, and working with arraylists in general.
I hope I wasn’t too unclear here and I appreciate any answer. :slight_smile:
Kjetil__

Ok, it seems that I should rather use List instead of ArrayList, which has better performance and is easier to use, and also more safe since you have to specify the type. This is correct yes? :slight_smile: