Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - habitoti

Pages: 1 ... 3 4 [5] 6
61
Support / Lifetime of self created sprite?
« on: November 30, 2013, 03:49:56 pm »
Hi,

I am just in the process of creating my own scene transition manager. I know there are a lot around using GUI textures, but I wanted to try my own using only toolkit 2D features, with a 1x1 black px scaled sprite that overlays the screen and will be tweened over the alpha. This all works great for the fade-out, the new scene is loaded, but then the GO-child of the TransitionManager singleton holding the black sprite no longer has the generated sprite on board. The GO itself is not destroyed on load, and I have no clue why the sprite isn't surviving the loading. This is how I set up the TransitionManager singleton:

Code: [Select]
         // create a black overlay for the whole screen
Texture2D fadeTexture = new Texture2D(1,1);
fadeTexture.SetPixel(0, 0, Color.black);
fadeTexture.Apply();

_fadeGO = tk2dSprite.CreateFromTexture(fadeTexture, tk2dSpriteCollectionSize.ForTk2dCamera(tk2dCamera.Instance),
new Rect(0,0,1,1), new Vector2(0.5f, 0.5f) );
_fadeGO.name = "Fader";
_fadeGO.transform.parent = transform;
_fadeGO.renderer.sortingLayerName = "Effects";
_fadeSprite = _fadeGO.GetComponent<tk2dSprite>();
_fadeSprite.scale = new Vector2(tk2dCamera.Instance.ScreenExtents.width/_fadeSprite.CurrentSprite.GetUntrimmedBounds().size.x,
                                tk2dCamera.Instance.ScreenExtents.height/_fadeSprite.CurrentSprite.GetUntrimmedBounds().size.y);
_fadeGO.SetActive(false);

DontDestroyOnLoad(this);

Is the tk2dUIManager somehow cleaning up sprites?

This is how it looks before the screen transition:


And this is the state after the new scene has been loaded:


Anything else that I need to do to save my little sprite over to the other side?

Thanks, habitoti

62
Support / Exception on Font Spritesheet Generation
« on: November 26, 2013, 08:50:48 am »
Hi,

I am including mono-spaced digits for a score display into a font spritesheet (which already was successfully created for two differnetly sized bitmaps of a regular font). These mono-spaced digits are a bitmap font generated only from digits and some additional characters (.-# etc.), so very small.
Are you expecting certain characters to be in the font on generation of the atlas? Because when I now push "commit", I end up with the following exception:

Code: [Select]
IndexOutOfRangeException: Array index is out of range.
tk2dSpriteCollectionBuilder.Rebuild (.tk2dSpriteCollection gen) (at Assets/TK2DROOT/tk2d/Editor/Sprites/tk2dSpriteCollectionBuilder.cs:1298)
tk2dSpriteCollectionEditorPopup.Commit () (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteCollectionEditor/tk2dSpriteCollectionEditorPopup.cs:446)
tk2dSpriteCollectionEditorPopup.DrawToolbar () (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteCollectionEditor/tk2dSpriteCollectionEditorPopup.cs:436)
tk2dSpriteCollectionEditorPopup.OnGUI () (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteCollectionEditor/tk2dSpriteCollectionEditorPopup.cs:889)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

NOTE: I additionally just found this only happens when I choose PNG as format for the collection. No exception occurs when I choose "Unity Texture" as atlas format.

63
Support / Re: Sharp Fonts
« on: November 24, 2013, 07:43:13 pm »
I am actually not looking for changing size at runtime, but a simple textcomponent where I just choose the font size at design time (as you would for a vector font), and tk2d would pick every other setting behind the scenes (which best bitmap data plus required scaling from there). If I am not happy how this turns out on a device later on, I simply add another rendered bitmap size, and tk2d would instantly adapt all these text components, taking the new available native size into account.

64
Support / Re: Sharp Fonts
« on: November 24, 2013, 12:26:21 pm »
Yes, I can set it like this. But I don't see any difference, I have to admit…

Is there any best practice for scaling fonts? Is there a rule of thumb or something that you should not scale further down than, say,  50%, or only in so-and-so steps etc.? Can I add other base sizes to the same font texture?

Maybe a great feature would be a text management in tk2d that would allow for setting actual fonts sizes, and some magic behind the scenes would take the closest available bitmap size and scale it down down to come up with the requested font size. Worst case you start with just one large bitmap size, but -- like for the different resolutions -- I could simply add other sizes and Toolkit 2D text management would take care of choosing the best. Given that fonts is such a pain with Unity, that would be a great additional value proposition!

I volunteer for testing ;-)

Regards, habitoti

65
Support / Sharp Fonts
« on: November 23, 2013, 09:22:14 am »
Hi,

in general I am a bit obsessed with sharp fonts (see my efforts on Cocos2D/iOS…  8)), and I am not too happy how far I can get with Unity & 2d Toolkit right now. I am just trying to apply the same fixing as described in my before-mentioned blog, but I just found also this blog on improving font scaling by applying trilinear filtering to the font material and using a shader with a mipbias of -0.65. This is pretended to be done on Unity with a modified Toolkit 2D shader, but beside a mentioning of how to achieve this, no more details are given. I tried to modify the BlendVertexColor shader like this:
Code: [Select]
fixed4 frag_mult(v2f_vct i) : COLOR
{
float4 coord;
coord.xy = i.texcoord;
coord.w = -0.65f;
fixed4 col = tex2Dbias(_MainTex, coord) * i.color;
return col;
}

but this doesn't work. Well, this was like heart sugery with a bread knife, since I have no clue about shaders at all and just wanted to give it a bold try, but to me that sounds like something useful as an additional shader for 2D toolkit, or? And you guys probably have no problem in creating such a working shader in a second  ;)

Regards, habitoti

66
Support / Re: Unity 4.3 sorting layers
« on: November 16, 2013, 09:23:32 pm »
You can lock a layer by clicking the lock symbol in the layer dropdown:



Unity sprites can't be selected any longer when assigned to such a locked layer. I would hope that there is some API to retrieve details about the sorting layers, at least whether it's locked or not. Then you could just ignore those sprites during selection whose renderers are assigned to that layer.

BTW: beyond the mentioned issue that I can't assign a tk2d-sprite to the "Default" layer (which would mean to set the renderers sortingLayerName property to null, but clicking on "Default" switches to the first entry only and does not stick to "Default"), it seems that the setting for the t2kdSprite layer assignment is not stable. Once I change the sorting layer setup (adding or deleting sorting layers), the layer assignment for the existing sprites change even if the initially set layer still exists.

Regards, habitoti

67
Support / Unity 4.3 sorting layers
« on: November 16, 2013, 07:51:08 am »
Hi,

one useful thing about the new sorting layers in 4.3 is the ability to lock them to prevent accidental selections and movements of e.g. background elements. However, Toolkit 2D seems not to consider that. If sprites are assigned to a locked layer, I can still select and move or size them. It would be great if the editor could consider the locked setting!

Another thing I noticed is that I can't assign a sprite to the default layer (when there are more than that one). Not sure whether this is a constraint already pf Unity or maybe just a bug in tk2d ;-)

Regards, habitoti

68
Support / Re: "Automatic Fit" Box Collider Issue after 2.3.0/4.3 Upgrade
« on: November 14, 2013, 04:01:40 pm »
Have sent you a mail to info@unikronsoftware.com.

Regards, habitoti

69
Support / "Automatic Fit" Box Collider Issue after 2.3.0/4.3 Upgrade
« on: November 14, 2013, 07:25:55 am »
Hi,

just upgraded Unity to 4.3 and 2D TOOLKIT TO 2.3.0 according to given procedures. Everything went smooth so far and runs in principle again. However I am facing two issues now where I can't see how to resolve them:

  • I have several pushbuttons with a normal and pressed state. These are top level UIItem GOs with the two sprite children for pushed and normal state. Pressing "Automatic Fit" in the UIItem component until < 2.3.0 correctly determined the union of the children extents for the parent GO, but now it set's the parent's collider extents to size 0, effectively disabling the button due to no more raycasting hits. As soon as I manually set the parent collider back to the expected size, it works again -- but of course I want to use the auto fit function ;-)
  • I have particle effects that have a larger negative z-component than all other on-screen items. Before 2.0.3/4.3, this assured they were always on top of everything. Now they are below every displayed sprite, but still above a background image. This made me think it's still some z-weirdness, but however I choose z, I can't get it in front. Looking in editor at 3D representation of the scene, the particles are really well on top of everything, so I have no clue why they are now suddenly hidden by all sprites.

Thanks, habitoti

70
Support / Re: 2-sided sprite?
« on: November 02, 2013, 11:15:49 pm »
Ok, got it…just tried it and it works like a charme…

Thanks for the instant support!

71
Support / Re: 2-sided sprite?
« on: November 02, 2013, 09:12:01 pm »
The 1.9 release notes said something like "Physically double sided sprite option instead of relying on a double sided shader". However, above you refer to a shader modification. I haven't really found out how to use the "double sided" mesh renderer option in the sprite collection, and there is really not much information in the wild on this (including the documentation)…can you point me to some helpful info source for creation and handling of a double-sided sprite?

Thanks, habitoti

72
Support / Re: Audio Volume
« on: October 20, 2013, 09:20:46 pm »
Excellent tip, 1k thanks!!

73
Support / Re: Audio Volume
« on: October 20, 2013, 11:41:08 am »
Excellent...that was exactly the issue. Turning 3D off makes it sound as it should (too bad that can't be done as a mass operation :-/ -- I have a lot of audio pieces...)

Thanks, habitoti

74
Support / Audio Volume
« on: October 20, 2013, 09:53:31 am »
Hi,

I found that click sounds that I attach to UI buttons have a very low volume only. Of course I can start to play with the global listener volume or the source volume, but thinking about it I just wondered: do orthographic cameras have an impact on the listener volume? I.e.: if I have high res graphics and a lower res device (so that the camera is logically farther away), does that change the overal volume then, because the audio source are more distant to the listener? Or is that all completely irrelevant? Sorry if this is a no brainer, I am just starting to connect the dots...

Thanks, habitoti

75
Support / Re: Stretch to fit for one sprite
« on: October 18, 2013, 07:20:41 am »
For those few that make their first babysteps and struggle a bit with the above high level direction of accomplishing this: here is the exact code you need to put into the Start function of a script attached to the sprite:

Code: [Select]
void Start () {

// make sprite fullscreen sized
tk2dSprite sprite = GetComponent<tk2dSprite>();

sprite.scale = new Vector3(tk2dCamera.Instance.ScreenExtents.width/sprite.CurrentSprite.GetUntrimmedBounds().size.x,
tk2dCamera.Instance.ScreenExtents.height/sprite.CurrentSprite.GetUntrimmedBounds().size.y,1);
}

Pages: 1 ... 3 4 [5] 6