oddgames / uitoolkit Goto Github PK
View Code? Open in Web Editor NEWSingle draw call UI solution for Unity with multi resolution support and more.
Single draw call UI solution for Unity with multi resolution support and more.
There's a problem when hiding and unhiding sprites, where part of them will still be rendered on the screen.
Here's a video that demonstrates the problem: http://www.screencast.com/t/F5xv03JoUll
I have a UIObject list of all my UIObjects to be hidden, here's the code responsible:
shopMenuSprites.OfType<UISprite>().ToList().ForEach(x => x.hidden = !x.hidden);
shopMenuSprites.OfType<UITextInstance>().ToList().ForEach(x => x.hidden = !x.hidden);
shopMenuSprites.OfType<UIAbstractContainer>().ToList().ForEach(x => x.hidden = !x.hidden);
make a background container
add items, scrollers, sprites, buttons doesnt matter
change the scale of the container
most items will not be positioned correctly
will debug it when i can,
The project needs to drop "Library" in place of "ProjectSettings"
When creating a text like "Some\nText", the text is properly split into 2 lines, however, the second line has a strange character before it.
If Aligned to the left, it looks like this:
Some
þText
When creating a vertical panel, and using my own "top" "middle" and "bottom" sprites, the middle sprite is not calculated to be tall enough to connect the top sprite and bottom sprite.
by modifying the "UIVerticalPanel.cs" file line 104, from:
var leftoverHeight = totalAvailableHeight - _topStripeHeight - _bottomStripHeight + 3;
to:
var leftoverHeight = totalAvailableHeight - _topStripeHeight + _bottomStripHeight + 3;
seems to fix the problem.
I have the following setup: a UIContinuousButton, which I later assign as a parent of both a text instance and a UIStateSprite. If I call button.destroy(), the button itself is removed, but neither the text instance nor the sprite are.
Is this the intended behaviour?
title says it all...if you destroy a container it is not removed from the manager, and if you recreate it you get errors...simple fix
UIAbstractContainer.cs line 148 added:
ITouchable touchable = this as ITouchable;
if( touchable != null )
{
this.__manager.removeFromTouchables(touchable);
}
create a horizontal scroller
add some sprites
add some buttons to the sprites
add some sprites to the 2nd set of sprites
create a 2nd scroller with same sets
creaete onTouchUpInside routines that hide the scrollers and show a new screen
quickly click with mouse on buttons
new screen will show up but scrollers will randomly not be hidden, wont scroll but the buttons are clickable
This repository contains a lot of binary files that it should not.
Here are the guidelines for using Unity with SCM:
http://unity3d.com/support/documentation/Manual/ExternalVersionControlSystemSupport.html
Currently if I clone down this repo, it can be a bit of a mess to get it working. The primary problem is that there are various binary files in the Library folder that are causing the issues.
The .gitignore seems to be correct (I have to look closer) but never-the-less files are being tracked and thus flowing into the commits that should not.
I'd like to clean this up, but wanted to check first to make sure there wasn't some reason this wasn't already done as per the documentation.
It would be useful if all UIObject
's exposed a hidden
property.
Hi!
I try to build & run any demo on Android but it fails with iphone related error.
I updated most up-to-date version of UIToolkit.
So I revert to old version but it works fine.
New version seems error on Android.
Thank you.
Adam.
havent tracked it down yet...ipod/iphone will sort incorrectly once, then be fine (most of the time)...ipad build sorts incorrectly all the time, even though fine in editor and fine in xcode
if an object is parented to something else and you set the localScale or scale of the child, the positioning gets lost
Is it possible? I just want to add a UIVerticalLayout as a child of a UIHorizontalLayout.
Button does not respond in webplayer. Any demo scene can reproduce this problem.
I have been using UIButton for background for the last couple of weeks for background but now i need to start optimizing.
I just need a background which i can hide manually.
What should I use and how (currently trying with UISprite,not having good results)? (i am willing to tweak the UIToolkit, adding constructors and all that)
create a vertical scroll container, add some images, run on device, touch the buttons, 30-40% of the time (or higher) the scroller will disappear due to all the container values getting messed up, sprites getting bad positions, etc...essentially everything gets clipped so it disappears...i've seen NaN for _scrollPosition in the debugger, not sure why it's happening
I am using positionFromTo and easing.back
it seems not to be any 'back' effect occurs...
The Positioning changes seem to have broken the ScrollableContainerTest scene.
Repo: Open that scene, attempt to scroll the scrolalble test container. It'll start off okay and then fly out of view. Probably some sort of "double" applying of translation.
Only Up and Left directions work on Android 3.0. Down and right don't work.
All directions work on Win7
void Start () {
var swipeDetector = UISwipeDetector.create( new Rect( 0, 0, Screen.width, 4*H ), 1);
swipeDetector.onSwipe += detectedSwipe;
}
void detectedSwipe( UISwipeDetector sender, SwipeDirection direction )
{
if (direction == SwipeDirection.Down)
// this doesn't work
if (direction == SwipeDirection.Up)
// this works
}
The way I fixed it is at line 133 of UISwipeDetector.cs:
......
// Check the delta move positions. We can rule out at least 2 directions
if( touch.deltaPosition.x > 0.0f )
touchInfo.swipeDetectionState &= ~SwipeDirection.Left;
if( touch.deltaPosition.x < 0.0f )
touchInfo.swipeDetectionState &= ~SwipeDirection.Right;
if( touch.deltaPosition.y < 0.0f )
touchInfo.swipeDetectionState &= ~SwipeDirection.Up;
if( touch.deltaPosition.y > 0.0f )
touchInfo.swipeDetectionState &= ~SwipeDirection.Down;
.......
Is there any method performing ‘Add’ produces a glow effect.
Hi!
I'd like to change font.
But when I use TWL(http://twl.l33tlabs.org/) and BMFont application to create Bitmap font and added(or replace with prototype) to resource but it doesn't work.
Help me.
This is a proposed plan to support TexturePacker's trim feature in UIToolkit. The changes would touch a lot of files, so looking for feedback before attempting.
The current code does not support the Trim feature of TexturePacker. This is perhaps one of the more important ones.
Trim finds the smallest rect that encompasses the pixels of an image that are not alpha=0 for each sprite that is packed into the atlas. Many times artists will animate things in sprites and rely on trim to remove this information during packing. This can result in huge savings in texture space.
However, to properly display trimmed sprites from the atlas, the sprites vertices must be moved to account for the discarded part of the image.
To make this work in UIToolkit, I've identified the following changes so far:
The UITextureInfo structure needs to keep track of the original size of the sprite (before it as packed and trimmed). TexturePacker emits this as "sourceSize". Unfortunately the identifier sourceSize was improperly already used in UITextureInfo for the property "sourceSpriteSize" in the control file. But to keep things simple, I suggest:
public struct UITextureInfo
{
public UIUVRect uvRect;
public Rect frame;
public Rect sourceSize;
public Vector2 originalSize;
}
Original size will need to be parsed (snipet from loadTexturesFromTexturePackerJSON):
var originalSize = (Hashtable)((Hashtable)item.Value)["sourceSize"];
var originalW = int.Parse( originalSize["w"].ToString() );
var originalH = int.Parse(originalSize["h"].ToString());
var ti = new UITextureInfo();
ti.frame = new Rect( frameX, frameY, frameW, frameH );
ti.uvRect = new UIUVRect( frameX, frameY, frameW, frameH, textureSize );
ti.sourceSize = new Rect( sourceSizeX, sourceSizeY, sourceSizeW, sourceSizeH );
ti.originalSize = new Vector2(originalW, originalH);
Optimally, an optimization would be to also maintain a bool which tells us if the image was trimmed. This is the "trimmed" property in the control file.
To use this information the code will have to be refactored to understand that when the UVs are changed the vertices might have to also change.
The following code is an example of how this logic would work for a centerized sprite. This is the code I use for camera facing sprites in 3D space (my own custom extension to UIToolkit):
void AssignUV(UITextureInfo textureInfo) // EXAMPLE ONLY
{
float w = textureInfo.originalSize.x;
float h = textureInfo.originalSize.y;
float hw = w / 2.0f;
float hh = h / 2.0f;
float left = (textureInfo.sourceSize.xMin - hw);
float right = (textureInfo.sourceSize.xMax - hw);
float top = (textureInfo.sourceSize.yMax - hh);
float bottom = (textureInfo.sourceSize.yMin - hh);
Vector3[] vertices = new Vector3[4];
vertices[0] = new Vector3(left, top, 0);
vertices[1] = new Vector3(left, bottom, 0);
vertices[2] = new Vector3(right, bottom, 0);
vertices[3] = new Vector3(right, top, 0);
OurMesh.vertices = vertices;
Vector2[] UVs = new Vector2[4];
UVs[0] = textureInfo.uvRect.lowerLeftUV + Vector2.up * textureInfo.uvRect.uvDimensions.y; // Upper-left
UVs[1] = textureInfo.uvRect.lowerLeftUV; // Lower-left
UVs[2] = textureInfo.uvRect.lowerLeftUV + Vector2.right * textureInfo.uvRect.uvDimensions.x; // Lower-right
UVs[3] = textureInfo.uvRect.lowerLeftUV + textureInfo.uvRect.uvDimensions; // Upper-right
OurMesh.uv = UVs;
}
This basic strategy would be adapted in UIToolkit.
The difficulty in this change is that UIToolkit currently makes the assumption that UV changes are very distinct of Vertex changes. And in many places where it will need to keep track of UV information it keeps and passes the UIUVRect of the UITextureInfo struct. For example, the Sprite Animaiton system has an array of UIUVRects for the animation frames. This will have to be refactored to an array of UITextureInfo structs. Similarly with many other places in the code.
It is the passing/tracking ofUI UVRects instead of UITextureInfo throughout the code that makes this refactor tricky.
I've not looked into how clipping might be impacted by this as I don't quite yet have my head around the clipping implementation.
There are other implications, as the actual "size" of the sprite is represented by something other than how the verts are positioned on the screen. This might impact touchable areas as well.
It is worth noting that support for the rotated property (another key feature of TexturePacker) can easily be part of this refactor. In fact to support rotated, moving from passing/storing UITextureInfo's instead of UIUVRects is pretty much required anyway.
This is observable if you try to scroll all the way to the bottom of the vertical scroll in the demo scene.
The console spams:
transform.position assign attempt for 'UIToggleButton' is not valid. Input position is { 0.000000, NaN, 1.000000 }.
UnityEngine.Transform:set_position(Vector3)
UIObject:set_position(Vector3) (at Assets/Plugins/UIToolkit/BaseElements/UIObject.cs:73)
UISprite:set_position(Vector3) (at Assets/Plugins/UIToolkit/BaseElements/UISprite.cs:159)
IPositionablePositioningExtensions:refreshPosition(IPositionable) (at Assets/Plugins/UIToolkit/Support/IPositionablePositioningExtensions.cs:901)
UIAbstractContainer:layoutChildren() (at Assets/Plugins/UIToolkit/BaseElements/UIAbstractContainer.cs:279)
UIAbstractTouchableContainer:layoutChildren() (at Assets/Plugins/UIToolkit/BaseElements/UIAbstractTouchableContainer.cs:283)
c__Iterator0:MoveNext() (at Assets/Plugins/UIToolkit/BaseElements/UIAbstractTouchableContainer.cs:97)
I'm looking into it
In the UIObject class, I found a Bug that i fixed with a simple Else statement. Here is the after code for the Mouse over effect. Just delete the current parentUIObject function and paste in this replacement. Or you can just add the else statement. When this is finished. The mouse over will start working correctly.
///
/// Setting the parentUIObject automatically sets up a listener for changes to the tranform.
/// When the parent transform changes, UISprite's will automatically call updateTransform to keep their
/// touch frames and actual positions in sync with the parent
/// </summary>
public UIObject parentUIObject
{
get { return _parentUIObject; }
set
{
if( value == _parentUIObject )
return;
// remove the old listener if we have one
if( _parentUIObject != null )
_parentUIObject.onTransformChanged -= transformChanged;
// reparent the UIObject in the same UIToolkit tree as it's children
//if( value != null && value.parent != parent )
// value.parent = parent;
_parentUIObject = value;
// if we got a null value, then we are being removed from the UIObject so reparent to our manager
if( _parentUIObject != null )
{
clientTransform.parent = _parentUIObject.clientTransform;
}
else
{
if( this.GetType() == typeof( UISprite ) )
clientTransform.parent = ((UISprite)this).manager.transform;
else
clientTransform.parent = null;
}
// add the new listener
_parentUIObject.onTransformChanged += transformChanged;
}
}
if you add text instance to a UIBackgroundLayout, the text does not respect the parent UIBackgroundLayout hidden flag
Whenever I try to set up UIToolkit I get an "InvalidCastException: Cannot cast from source type to destination type." error. I've just started using UIToolkit so I don't know much about it, but I'm pretty sure I've got everything set up right. My TexturePacker file was renamed to a .txt, so its not that. When I double click the error it takes me to this line of code in the UISpriteManager script:
"var frames = (Hashtable)decodedHash["frames"];"
Any ideas?
Hi,
I'm trying to make a in-game menu layout, so I decide to create a simple menu containing 2 UIHorizontalLayouts "stacked" with 3 elements each, so:
but1 | but2 | but3
but4 | but5 | but6
So, I write this, that makes some sense to me:
var layout1 = new UIHorizontalLayout(spacingBetweenItems);
layout1.beginUpdates();
layout1.verticalAlignMode = UIAbsoluteLayout.UIContainerVerticalAlignMode.Top;
layout1.addChild(but1, but2, but3);
layout1.pixelsFromTopLeft(bannerHeight + spacingBetweenItems, spacingBetweenItems);
layout1.endUpdates();
layout1.matchSizeToContentSize();
var layout2 = new UIHorizontalLayout(spacingBetweenItems);
layout2.beginUpdates();
layout2.verticalAlignMode = UIAbsoluteLayout.UIContainerVerticalAlignMode.Top;
layout2.addChild(but4, but5, but6);
layout2.pixelsFromTopLeft((int)(layout1.height + Mathf.Abs(layout1.position.y)) + spacingBetweenItems, spacingBetweenItems);
layout2.endUpdates();
layout2.matchSizeToContentSize();
The interesting part is layout2.pixelsFromTopLeft((int)(layout1.height + Mathf.Abs(layout1.position.y)) + spacingBetweenItems, spacingBetweenItems);
.
In my case, layout1.position.y
gives me a negative value (still don't know why, so if someone know an explanation would be appreciated), so that's why I use the absolute value (yeah, it's more like a temporal fix or something like).
I'm using iPhone's HD resolution (640x960) and things work fine, but when I do on iPhone's resolution (320x480) things doesn't seem to work the same way.
However, I've come up with something:
iPhone: layout1.position.y is -59
iPhone HD: layout1.position.y is -118
This is a double size (which makes sense, IMHO). And if I hardcode 118 instead of Mathf.Abs(layout1.position.y), things work great! What's the problem? What should I do? There's a better way of doing all of this?
Note that I'm using 2x textures when switching to iPhone HD
UIToolkit crashed upon opening downloaded zip. I'm using the latest stable version of Unity 3.4.2f2. Just wondering if anyone else had experienced this on Mac OS Lion?
Can someone advise on what parts of the package that I need to copy in say an empty project to begin working with it?
I copied the plugins folder for now. I wish I could see the demos but breaking the cache / temp would mean that all demo scenes would have broken links to assets and scripts.
Not sure this is worth chasing down, but I was having a problem with sometimes glyphs disappearing inside a UITextInstance. I was updating the instance through a SendMessage call, and doing so quite frequently.
For instance, if the text was supposed to be "10912", it displayed " 0 12", and then when the next update came through, it'd be fine.
It didn't seem to match up to if it got more than one update per frame, but once I started just saving those text updates and applying them in the next Update() call, the problem went away.
The issue is very hard to explain, so i recorded a video of how the scrollable vertical layout behaves:
Hi!
I'd like to add animation for destroying text smoothly not immediately.
What should I do for that?
Could you give me some code snippet if possible?
Thank you,
Best Regards,
Adam
I tried opening KitchenSink.unity in DemoScenes/ and got 4 warnings for "The referenced script on this behavior is missing."
Same for ColorPicker.unity.
Using this code:
...
var spacingBetweenItems = 3;
var layout1 = new UIHorizontalLayout(spacingBetweenItems);
layout1.beginUpdates();
layout1.verticalAlignMode = UIAbsoluteLayout.UIContainerVerticalAlignMode.Top;
layout1.addChild(tm1, tm2, tm3);
layout1.matchSizeToContentSize();
layout1.pixelsFromTopLeft(bannerHeight + spacingBetweenItems, spacingBetweenItems);
layout1.endUpdates();
Where tm1, tm2 and tm3 are UIContinuousButtons (and have a height of 108), layout1.height
returns 0. Is it a bug? What am I doing wrong?
Problem in sprite positioning if sprite centerized.
sample:
var sprite = spriteToolkit.addSprite( "spritename.png", 0, 0, 1 );
sprite.centerize();
sprite.positionFromBottomLeft( .0f, 0.f );
sprite must be at bottom left but wrongly in near center left
Solution:
if sprite used centerize(); then
wrong
line 76 pos.y = -UIRelative.yPercentFrom( UIyAnchor.Bottom, percentFromBottom, sprite.height );
must be
line 76 pos.y = -UIRelative.yPercentFrom( UIyAnchor.Bottom, percentFromBottom, 0 );
but only for centrerized sprite
maybe some like:
if (sprite.gameObjectOriginInCenter)
pos.y = -UIRelative.yPercentFrom( UIyAnchor.Bottom, percentFromBottom, 0 );
else
pos.y = -UIRelative.yPercentFrom( UIyAnchor.Bottom, percentFromBottom, sprite.height );
P.S. possibly in anothers metods same error ...
Hi,
Sometime buttons and checkbox don't recieve click event in the ScrollableContainerTest scene example.( in the container )
please fix that.
Thanks.
It seems like multiple scrolls followed with a fast swipe makes the content disappear. I traced i down to this line of code in UIAbstractTouchableContainer:
var avgVelocity = total / _velocities.Count;
Looks like _velocities count becomes zero, making avgVelocity NaN and thus scrollPosition becomes NaN.
/*
I added a couple of functions for the mouse over effect. So if you have a 3 state button like,
var playButton = UIButton.create( "playUp.png","playOver.png", "playDown.png", 0, 0 );
This will work work correctly without having to do the current hack that's in the Kitchen sink tutorial.
*/
using UnityEngine;
public class UIButton : UITouchableSprite
{
public delegate void UIButtonTouchUpInside( UIButton sender );
public event UIButtonTouchUpInside onTouchUpInside;
public delegate void UIButtonTouchDown( UIButton sender );
public event UIButtonTouchDown onTouchDown;
public UIUVRect highlightedUVframe;
public AudioClip touchDownSound;
#region Constructors/Destructor
#region Three State Button
public static UIButton create( string filename,string mouseOver,string highlightedFilename, int xPos, int yPos )
{
return UIButton.create( UI.firstToolkit, filename,mouseOver,highlightedFilename, xPos, yPos );
}
public static UIButton create( UIToolkit manager, string filename,string mouseOver, string highlightedFilename, int xPos, int yPos )
{
return UIButton.create(manager, filename,mouseOver,highlightedFilename, xPos, yPos, 1 );
}
public static UIButton create( UIToolkit manager, string filename,string mouseOver, string highlightedFilename, int xPos, int yPos, int depth )
{
// grab the texture details for the normal state
var normalTI = manager.textureInfoForFilename( filename );
var frame = new Rect( xPos, yPos, normalTI.frame.width, normalTI.frame.height );
var hoveredTI=manager.textureInfoForFilename(mouseOver);
var highlightedTITwo = manager.textureInfoForFilename( highlightedFilename);
return new UIButton(manager,frame,depth,normalTI.uvRect,hoveredTI.uvRect,highlightedTITwo.uvRect);
var highlightedTI = manager.textureInfoForFilename( highlightedFilename);
return new UIButton( manager, frame, depth, normalTI.uvRect, highlightedTI.uvRect);
}
public UIButton( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame,UIUVRect hoveredUVframe,UIUVRect highlightedUVframe ):base( frame, depth, uvFrame )
{
// If a highlighted frame has not yet been set use the normalUVframe
if( highlightedUVframe == UIUVRect.zero )
{
highlightedUVframe = uvFrame;
}
else if(hoveredUVframe == UIUVRect.zero )
{
hoveredUVframe=uvFrame;
}
this.hoveredUVframe =hoveredUVframe;
this.highlightedUVframe = highlightedUVframe;
manager.addTouchableSprite( this );
}
#endregion
public static UIButton create( string filename, string highlightedFilename, int xPos, int yPos )
{
return UIButton.create( UI.firstToolkit, filename, highlightedFilename, xPos, yPos );
}
public static UIButton create( UIToolkit manager, string filename, string highlightedFilename, int xPos, int yPos )
{
return UIButton.create( manager, filename, highlightedFilename, xPos, yPos, 1 );
}
public static UIButton create( UIToolkit manager, string filename, string highlightedFilename, int xPos, int yPos, int depth )
{
// grab the texture details for the normal state
var normalTI = manager.textureInfoForFilename( filename );
var frame = new Rect( xPos, yPos, normalTI.frame.width, normalTI.frame.height );
// get the highlighted state
var highlightedTI = manager.textureInfoForFilename( highlightedFilename );
// create the button
return new UIButton( manager, frame, depth, normalTI.uvRect, highlightedTI.uvRect );
}
public UIButton( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UIUVRect highlightedUVframe ):base( frame, depth, uvFrame )
{
// If a highlighted frame has not yet been set use the normalUVframe
if( highlightedUVframe == UIUVRect.zero )
highlightedUVframe = uvFrame;
this.highlightedUVframe = highlightedUVframe;
manager.addTouchableSprite( this );
}
#endregion;
// Sets the uvFrame of the original UISprite and resets the _normalUVFrame for reference when highlighting
public override UIUVRect uvFrame
{
get { return _uvFrame; }
set
{
_uvFrame = value;
manager.updateUV( this );
}
}
public override bool highlighted
{
set
{
// Only set if it is different than our current value
if( _highlighted != value )
{
_highlighted = value;
if ( value )
base.uvFrame = highlightedUVframe;
else
base.uvFrame = _tempUVframe;
}
}
}
// Touch handlers
public override void onTouchBegan( UIFakeTouch touch, Vector2 touchPos )
public override void onTouchBegan( Touch touch, Vector2 touchPos )
{
highlighted = true;
/*
initialTouchPosition = touch.position;
*/
if( touchDownSound != null )
UI.instance.playSound( touchDownSound );
if( onTouchDown != null )
onTouchDown( this );
}
public override void onTouchEnded( UIFakeTouch touch, Vector2 touchPos, bool touchWasInsideTouchFrame )
public override void onTouchEnded( Touch touch, Vector2 touchPos, bool touchWasInsideTouchFrame )
{
highlighted = false;
// If the touch was inside our touchFrame and we have an action, call it
if( touchWasInsideTouchFrame && onTouchUpInside != null )
onTouchUpInside( this );
}
}
Seems as if the latest refactoring in commit 5f18bc8 has broken the relative positioning.
In short, it looks like IPositionablePositioningExtensions.cs: refreshPositions is just wrong now.
// Get anchor info
UIAnchorInfo anchorInfo = sprite.anchorInfo;
// Get parent anchor position
Vector3 position = parentAnchorPosition(anchorInfo.ParentUIObject, anchorInfo.ParentUIyAnchor, anchorInfo.ParentUIxAnchor);
Say the screen width is 320. If there is no parent, this would move a Right Anchored object to X of 320.
Then:
// Add position offset
if (anchorInfo.UIPrecision == UIPrecision.Percentage)
{
position.x += UIRelative.xPercentFrom(anchorInfo.UIxAnchor, anchorInfo.OffsetX);
position.y -= UIRelative.yPercentFrom(anchorInfo.UIyAnchor, anchorInfo.OffsetY);
}
This causes it to move it another 320 to the right so 640, becaues UIRelative.xPercentFrom() does this:
// Get inital offset
float offset = Screen.width * percentOffset;
// If anchor is right the offset is flipped
if( anchor == UIxAnchor.Right )
{
offset = Screen.width - offset;
}
return offset;
So with screen width of 320, 320 * 0 is 0, but because of Anchor.Right, that's 320-0, or 320. Which gets added and thus 640.
Anyway, anything anchored to the right or bottom of the screen is being thrown off screen.
I have tried updating UIToolkit to the master branch but am experiencing a problem.
I was changing xPos and yPos of UITextInstance's to reposition them but that doesn't appear to be working anymore.
Is this a problem or am I doing this wrong?
In the picture there are two UIBackgroundLayout (the actual background and the layout that contain those 6 buttons).
The second layout (black box with orange stroke) contains 6 UIToggleButton. As you may see, there's a problem concerning alpha resolution. I'm using a material with the UIToolkit/Alpha Enabled shader. I've tried the three shaders UIToolkit provides, with no result.
Any ideas?
If you put a centerized sprite inside a UIScrollableVerticalLayout, clipping is incorrect. Instead of correctly clipping the sprites, they seems to be clipped earlier or later than needed and slide around while doing so.
I downloaded the package file & then downloaded all the updates and overwrote all the plugins in my Unity project, however the centerize function no longer works. Not sure how to trouble shoot this as it was working fine before.
How do you clean up the scene, if you want to remove UIText?
they not have a destroy method on them. I can set the UITextInstance to "" and destroy all it's child UISprites, but then the UITextInstances remain in the scene.
What't the preferred way to get rid of them?
I use the new PlaySpriteAnimation and I see that my animation never stops, the loopCount doesn't count.
I think it's just a bug: in UISpriteAnimation class, row 36, I changed this:
while( _isPlaying && ( loopCount >= 0 || loopCount == -1 ) ){...}
to this:
while( _isPlaying && ( loopCount > 0 || loopCount == -1 ) ){...}
so when loopCount is 0, the while cycle stops and so the animation.
Once a text instance has clear() called on it, the text can still be changed but it can no longer be animated. I tried this in the demo scene to make sure it wasn't something in my game code. If you try to enter new text to one of the text instances in the IEnumerator modifyTextInstances() method after the text instance is cleared and then try to animate it with a PositionTo then this error comes up:
MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Transform.TransformPoint (Vector3 position)
UISprite.updateTransform () (at Assets/Plugins/UIToolkit/BaseElements/UISprite.cs:311)
UISprite.transformChanged () (at Assets/Plugins/UIToolkit/BaseElements/UISprite.cs:220)
The reason I was trying this out is because changing text in this latest UIToolKit build seems to not remove the pervious text in the text instance. So if I do this:
text1.text = "long test";
text1.text = "short";
the result is:
shorttest
or a jumble of both texts in the same space.
after disabling and re-enabling UIToggleButton the uvFrame points always to UITouchableSprite._tempUVframe which is by default the first (unselected) state of the UIToggleButton. for normal buttons this is ok, but for the toggle it's wrong as it looses it's current state (only visually, not boolean)
did not dare to try to fix this, as UITouchableSprite is the base for all other ones and i'm coming from AS3 so im not yet very used to c#'s inheritance behaviour.
Upon building to iPhone I am getting the following warning message:
Assets/Plugins/UIToolkit/UI.cs(79,138): warning CS0618: `UnityEngine.iPhoneSettings.generation' is obsolete: `generation property is deprecated. Please use iPhone.generation instead.'
Should be very easy to fix.
Thanks for the fantastic toolkit! Keep up the great work
running on iphone, game only supports landscape, UIToolkit will display portrait in landscape mode
Hi,
I saw that any methods of the new version of the UIRelative class that contains "Pixel" doesn't work anymore - yPixelFrom/to and xPixelFrom/to.
The old one calculates the value based on Screen dimension, the new one does nothing like this.
Is it me, or is it just broken?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.