Hello Guest

Author Topic: Access Sprite GameObject from a batch  (Read 4207 times)

slydog

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 1
    • View Profile
Access Sprite GameObject from a batch
« on: September 28, 2012, 09:41:07 pm »
Once I commit the batch, the sprite game objects disappear from the hierarchy (as designed I assume).
Since I want batching, how to I reference a specific sprite from another script?

Background:  I have a simple arrow sprite that represents the wind direction.  I have a WindManager that is a static class with a windSprite property, and I want to specify the wind sprite via a 'SetWindSprite()' method or something.

I'll do this via my GameManager, ideally through a public property I can set in the inspector.  I have it working now that I can drag my sprite into the GameManager script, and it works fine when I call 'SetWindSprite()' in my WindManager.  But with batching, I have nothing to drag?!  I hope this makes sense.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Access Sprite GameObject from a batch
« Reply #1 on: September 28, 2012, 09:57:40 pm »
The static sprite batcher is just for static backgrounds and other static objects. In this case, your object doesn't have to be a static sprite batcher - you'll still get batching from the Unity dynamic batching system. You don't HAVE to use the static sprite batcher to get batching, its just a much more efficient way to do it when everything is static.