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 - LaserDinosaur

Pages: [1] 2 3
1
Support / What is Linked Sprite Collections used for?
« on: February 02, 2016, 04:52:50 pm »
Stupid question but, what exactly is the purpose of Linked Sprite Collections?
 
When I first read of the feature, I was hoping that I could take my two sprite collections and link them together into one atlas, reducing the amount of draw calls. However, it seems like it's maybe meant for linking to various types of the same image, like player.png and player_2x.png, without having to manually manage the files?

Basically I have my main sprite collection and a second sprite collection just for fonts. I'd like to have the main sprite collection link and pull in the data from the font collection, but I don't know if that is what this feature is meant to do. Is this not what it's for?


2
Support / Null error in tk2dTextGeomGen when calling .Commit() twice
« on: November 25, 2015, 01:59:58 pm »
Hi there

I'm using a tk2dTextMesh and calling Commit() because I need the bounds in the same frame.

However I seem to be getting an error in tk2dTextGeomGen.cs, method 'GetMeshDimensionsForString' in line 39:

'for (int i = 0; i < str.Length && target < data.maxChars; ++i)'


I get an object not defined (null) error in the str property. What's really strange about it is that the cause of it seems really unreliable. What I've found so far:

1) It only happens when Commit() is called twice on the same textmesh in the same frame.
2) Placing two Commit() calls right after each other works fine, it has to be an external class call
3) Not all external calls break it - it seems to happen more when being called through delegates, but not all the time.
4) I setup a blank project and can't seem to replicate the issue, which I realize makes answering this question a lot more difficult.

My only guess is that when Commit calls FlushQueues, perhaps the delegates are firing at the same time (as far as C# is concerned anyway), removing the text mesh in the wrong order and causing an issue. I'm not sure, it's very weird.

Any advice on what might cause this method to fall over? I'm using tk2d 2.5.4 and Unity 5.2.0f3.

3
Support / Re: How to move tk2dTileMap
« on: October 04, 2015, 10:19:22 pm »
I'd suggest looking into some tutorials on the transform.position property. Once you've set the tilemap to the position you want, you can then call the following to rebuild the tilemap at the new location:

Code: [Select]
GetComponent<tk2dTileMap>().Build();

4
Support / Re: How to move tk2dTileMap
« on: October 04, 2015, 07:49:07 pm »
If you're just trying to shift the entire tilemap, you can highlight "Tilemap" in the hierarchy (moving "Tilemap Render Data" wont do anything, it will reset when you hit play) and then move the entire thing using the editor position handles:



5
Support / Re: tk2dUITextInput doesn't working in Unity 5.2
« on: October 02, 2015, 08:09:06 pm »
My guess is it's that then - with TK2D (or any Unity asset) it's usually a good idea to delete the folder the plugin is in (eg. TK2DROOT) before importing the new version. If you don't, Unity just merges the two folders together and you end up with a mish-mash of two different versions.

6
Support / Re: tk2dUITextInput doesn't working in Unity 5.2
« on: October 01, 2015, 10:48:35 pm »
When you updated to 2.5.4, did you import the asset into the existing TK2DROOT folder? Or did you delete the TK2DROOT folder and then import?

7
Support / Re: tk2dUITextInput doesn't working in Unity 5.2
« on: October 01, 2015, 05:36:36 am »
What version of 2d toolkit do you have? I'm running 2.5.0 and 2.5.4 and it's working fine in both. Perhaps your running a version of tk2d that was released before Unity 5.2? (Note the asset store version is quite slow to update, you might want to grab the latest version here from the forums if that's the case).



What happens if you try opening the test demo at "TK2DROOT/tk2dUI_demo/2 - UI Layout Demo" and try using the sample text box. Does that one work?

One thing to check is the actual input textmesh game object in the hierarchy (in the demo its under the input control "TextInputWithButton" as "InputText"). It could be the text is actually updating but there's an issue with your font or UI camera that's preventing it from being rendered.

8
Support / Re: Is there a way to sort palette tiles?
« on: September 16, 2015, 08:02:55 pm »
@Unikron: Huh, interesting. I always thought that the spritesheets were just visual organizers inside sprite collections. I figured if everything is being saved off to a single sprite atlas on the disk, then the individual spritesheets are still in the same sprite atlas file, retaining sprite batching. Does that mean if I have a sprite collection containing two spritesheets which is being used for a tilemap, that's going to break batching?

(If my question is going off topic, I can move it to a new post)

9
Hi Unikron

Thanks for the feedback, feels quite nice to get the thumbs up from the mastermind himself  ;D

As for the package not loading first time, I wonder if it was because I exported the package from Unity 5.1. Unity packages contain thier own meta files, so perhaps the first time you opened it the package got updated to 5.2, and then only on the second attempt it loaded properly. I'll re-export a 5.2 version, hopefully that fixes it.

When I get time I'll do a final version with some samples and put it up on the 'Add-ons and Extensions' forum.

Cheers!

10
Support / Re: Is there a way to sort palette tiles?
« on: September 14, 2015, 07:10:42 pm »
Am I correct in thinking that you want to be able to click your "Foreground" layer in the tile editor and only see the tiles from your sprite collection that apply to the foreground?

I don't think you can do that at the moment, but it would be nice to have. Perhaps if the tilemap detected that the sprite collection contains multiple spritesheets, you could choose which ones are available to the layer.

@Unikron: Do the performance issues you mentioned back in 2014 still apply today? Multiple sprite collections I could see being a performance issue, but if your just showing/hiding the available spritesheets in a single spritecollection, would that work?

11
Support / Re: Is this for me?
« on: September 14, 2015, 06:46:03 pm »
You could use the tilemap feature to do this: Once all your tiles are added into the scene, tk2d 'chunks' your tiles into edge collider groups so that you don't cause the physics engine to have a complete fit. Noble Weapons has a video over on youtube that covers the settings pretty well.

If you want your tiles to change over time, you can set them as Data Tiles which just point to a prefab (see the last item in the tutorial). That prefab can have an animator attached to it and a script that changes it's tile given certain weather conditions.

However, I don't know for certain how well the performance scales if you have thousands of tiles in a scene all with their own animators and scripts attached, but a 256x256 grid isn't really that big (not sure how your fitting hundreds of thousands of tiles in there). Also, you put your measurement as 256x256x10 - does that mean your doing a 3d box full of tiles more like Minecraft?

12
Support / Enhanced Drag and Drop for 2d toolkit - looking for code feedback.
« on: September 11, 2015, 01:16:34 am »
Hi all

As part of the game I'm working on I needed a drag and drop system that worked closer to how Unity's canvas+event system works. 2d toolkit has a drag and drop system, but it's very simple and only maps a button to your mouse position.

I made up a small enhancement that lets you:
  • Hook into events using interfaces
  • Events include OnPointerEnter, OnPointerExit, OnDrop, OnBeginDrag, OnEndDrag and OnDrag.
  • Failure states that will automatically return your draggable back to its origin position when no dropzone is found.
  • Ability to have draggable snap to the pointer on move (the default in tk2d is to keep the distance relative).
  • Out-of-parent folder support. Usefull for when you are dragging an item which needs to disable the parent folder without affecting the draggable.
  • Public fail state trigger: If you drop an item in your inventory, you will get an "OnEndDragSucceeded" event because the draggable found a dropzone. Once you have the item you can then, for example, do a requirements check against the player attributes and if they don't have high enough stats, you can manually call "TriggerFailedDropEvent". This will call the method that is already implementing IOnEndDragHandler just as if it failed normally.
  • Deadzone support: Give the draggable a deadzone distance and the OnBegin handlers wont fire until its exceeded that distance. Very useful for when your draggables also have button click events where you dont want very small movements triggering the drag event.



Now with that, I was wondering if you guys could take a peek and let me know if you spot anything that could be improved. I'll eventually put a final version in the announcements forum with documentation, but I wanted to make sure it was following best practices first. For example, one possible point of contention is that on line 259 of tk2dUIDragItem_Custom.cs I'm using a .Where statement to filter out raycasts that are hitting themselves. Unikron seems to avoid using statements like this, probably to ensure iPhone support, but my alternatives always wound up being big cludgy messes of code. If anyone has any ways to replace that, do let me know.

Download via dropbox

tk2dUIDragItem_Custom.cs contains all the code to get the drag and drop to work (well, including tk2d of course). It's an extended version of the tk2dUIDragItem script so bits and pieces might look familiar. There are also two example files called "DragWithIcon" and "DropZOne".

If you want to get an idea of how it works, the code section of this video is basically how this extension works.

13
Showcase / Re: Shoots Em' Guy [ANDROID]
« on: September 08, 2015, 04:03:42 pm »
Neat! I love the gameboy style graphics.

14
For #3, you can use prefabs with tk2d animators attached to them and then add them as a data tile. At the end of this tutorial, part 5 talks about data tiles. Just replace the steps adding a rigidbody with adding a tk2dAnimator script.

The drawback is you can't flip or rotate data tiles without adding some extra custom code, even though when you paint them into the scene with the tile editor they will appear flipped/rotated (they reset when you run the scene). Just be aware if you do modify the code to allow rotation, it will break batching which can affect performance (or at least it used too).


15
Support / Re: Still in edit mode
« on: September 04, 2015, 02:46:07 pm »
There should be a commit button on your tilemap: .

During development it's usually fine to just leave it in edit mode, although I find every now and then there is a setting that only kicks in once the tilemap is committed.

Pages: [1] 2 3