Is it possible to change the entire sprite sheet from script ?

Hello Everyone,

I want to know if there is a way to do the following :

Say you have a sprite sheet named “Parent” that contain two sprites, like this [* *]
You set the “Parent” sprite mode to multiple and then you are able to use the two * sprites individually.
Now you have another sprite sheet named “New Parent” that has the exact same property of “Parent” but with different images inside, [# #], these images are also the exact same property (size) of the other two * in the “Parent” sprite.

Is there a way to change between “Parent” and “New Parent” at runtime ? this can very helpful when using same character but with different skin.

In case it doesn’t, is there a way to access the sprite children of the sprite parent ?
when you create a mutlriple sprite sheet in unity, each child will has a number ID, it would be very helpful if we can access that.

Thank you

Hi,
you can call different sprites through scripting on a special event.
or u can create animation clips using single or multiple sprites and call those on a special event like collision, trigger,key pressed etc.
for example : in the following script i have used multiple animation stages for character movement.
(Direction 0,1,2,3).
I hope this may help/explain what you are looking for
As you have not mentioned exactly when you want to change the character appearance at run time.
All the best.

	void Update () 
	{
		float verticalInput = Input.GetAxis("Vertical");
		float horizontalInput = Input.GetAxis("Horizontal");

		if (verticalInput < 0) 
		{
			animator.speed = 1;
			animator.SetInteger("Direction",0);
		}
		else if (verticalInput > 0) 
		{
			animator.speed = 1;
			animator.SetInteger("Direction",1);
		}
		if (horizontalInput < 0) 
		{
			animator.speed = 1;
			animator.SetInteger("Direction",2);
		}
		else if (horizontalInput > 0) 
		{
			animator.speed = 1;
			animator.SetInteger("Direction",3);
		}
		if (horizontalInput == 0 && verticalInput == 0)
		{
			animator.speed = 0;
		}