Home › Page › UghSpriteDefinition

UghSpriteDefinition

Revision for “UghSpriteDefinition” created on 17 April, 2013 @ 18:51

Title
UghSpriteDefinition
Content
Inherits from ScriptableObject UghSpriteDefinitions are created in the editor via the sprite atlas process.  An UghSpriteDefinition is a collection of UghSpritePrototypes, where each prototype corresponds to a screen resolution.  At runtime, an UghSpriteDefinition will choose the best UghSpritePrototype to use based on the resolution of the screen. <a title="UghSprite" href="http://ugh.graveck.com/?incsub_wiki=ughsprite">UghSprites</a> use UghSpriteDefinitions to define the texture they will display. UghSpriteDefinition makes use of the ReferenceLink class.  Please read the documentation on <a title="ReferenceLink" href="http://ugh.graveck.com/wiki/referencelink">ReferenceLink</a> to understand how this impacts memory usage. [table caption="Variables" colwidth="20%|20%"] name, type, description CurrentPrototype, <a title="UghSpritePrototype" href="http://ugh.graveck.com/wiki/ugh-scripting-reference/ughspriteprototype-2">UghSpritePrototype</a>, The prototype that most closely matches the current screen resolution. DefaultPrototype, <a title="UghSpritePrototype" href="http://ugh.graveck.com/wiki/ugh-scripting-reference/ughspriteprototype-2">UghSpritePrototype</a>, The prototype that is used if a screen resolution cannot be determined. resolutions, <a title="UghSpriteResolutionDefinition" href="http://ugh.graveck.com/wiki/ughspriteresolutiondefinition">UghSpriteResolutionDefinition</a>[], A list of <a title="UghSpriteResolutionDefinition" href="http://ugh.graveck.com/wiki/ughspriteresolutiondefinition">UghSpriteResolutionDefinitions</a> that UghSpriteDefinition may choose from at runtime. [/table] [table caption="Events" colwidth="20%|20%"] name, type, description OnCurrentPrototypeChanged, event, Called when the value of CurrentPrototype changes (usually when a prototype is initially chosen at runtime.) [/table] [table caption="Class Functions" colwidth="20%|20%"] name, type, description DefinitionFromPrototype, UghSpriteDefinition, "Given an UghSpritePrototype, creates and returns an UghSpriteDefinition with the prototype as the DefaultPrototype. [/table] <strong>Using UghSpriteDefinition in Script</strong> UghSpriteDefinition is a solution for projects with target platforms that have different resolutions.  For example, a project may be built for both iPhone and iPad and require larger textures to maintain an attractive display on the iPad's larger screen. UghSpriteDefinition's CurrentPrototype is chosen and loaded at runtime.  This is a slightly deferred load (it happens during the OnEnable ScriptableObject event.)  As such, if you need the CurrentPrototype as soon as it is loaded, you should register for the OnCurrentPrototypeChanged event. UghSpriteDefinition's DefaultPrototype is used both as a fallback if the CurrentPrototype fails to load at runtime, and as the prototype used in Unity's scene editor window.  (DefaultPrototype is not deferred like CurrentPrototype, and thus is always safe to reference in script.)
Excerpt


OldNewDate CreatedAuthorActions
17 April, 2013 @ 18:51 admin
2 April, 2013 @ 21:32 [Autosave] admin
2 April, 2013 @ 21:31 admin
28 March, 2013 @ 22:00 admin
28 March, 2013 @ 21:59 admin
28 March, 2013 @ 21:59 admin
28 March, 2013 @ 21:37 admin
28 March, 2013 @ 21:36 admin
18 March, 2013 @ 17:12 admin
18 March, 2013 @ 17:06 admin
18 March, 2013 @ 17:03 admin
11 March, 2013 @ 18:16 admin
7 March, 2013 @ 22:28 admin
7 March, 2013 @ 22:27 admin
7 March, 2013 @ 22:22 admin
6 March, 2013 @ 21:49 admin
6 March, 2013 @ 21:49 admin