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

Pages: [1]
1
Support / Custom renderer for tiles
« on: September 21, 2017, 04:22:31 pm »
Hi,

Let me first describe what I am trying to do, in case I'm just barking up the wrong tree.  I am working on an isometric game, and have thus far created a tilemap with two layers - one containing ground tiles (so far just the same grass tile) and one containing things like trees and bushes.  It occurs to me that this may already be wrong - perhaps I should be placing that landscape "furniture" as independent sprites instead of as tilemap elements?

Anyway, I now have the problem that any isometric game has - how to handle occlusion of animated characters as they move around things like trees.  I googled around looking for solutions, but the most common one - splitting sprites into a top half and a bottom half, and then making sure that animated characters can't walk paths that would spoil this illusion - seems unsatisfactory, and it would require me to start messing about with paint programs, and that would just end in tears...   :)   Eventually, I found a Unity package that implements a shader-based sprite renderer that supports per-pixel draw order, amongst some other nice stuff like 3D-style lighting.  This is the product: https://forum.unity.com/threads/shiva-2-5d-isometric-engine.486274/

So, I *think* all I need to do is change my tk2d sprites to use this renderer instead of the standard SpriteRenderer, but I can't find a place to do that in SpriteCollection.  Do you think I will be able to integrate this thing with tk2d?

Thanks!

2
Support / Re: Can't get world ray to identify tile
« on: September 21, 2017, 04:08:43 pm »
Thanks for the advice - works great

3
Support / Re: Can't select Sprite animation
« on: September 21, 2017, 04:07:59 pm »
I was renaming the Sprite Collection in the Inspector panel - in the name field that appears right at the top, regardless of the type of game object you are looking at.  It doesn't seem like there is a way to separately commit when you change things in that panel - you change something, it's changed...?

Anyway, I discovered that if I instead change the name of the Sprite Collection by selecting it in the Project assets view, pressing F2 and then renaming it in-place, that works fine and the name does not revert.  So this is not an issue for me any more

4
Support / Can't get world ray to identify tile
« on: September 16, 2017, 10:28:36 pm »
I am using a Tilemap and right now I have no real use for colliders so I want to avoid them.  However, I do need to respond to mouse clicks on the map.  I came across this post: http://2dtoolkit.com/forum/index.php/topic,2304.msg11501.html

In there is this advice:

Quote
Don't use colliders. Get the intersection of the cursor / touch ray and tilemap plane
      Plane p = new Plane(tileMap.transform.forward, tileMap.transform.position);
      Ray r = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
float hitD = 0;
if (p.Raycast(r, out hidD)) {
  Vector3 hitPoint = r.GetPoint(hitD);
}

When I try to do this, I get this error:

Unable to convert GUI point to world ray if a camera has not been set up!

I have tried this with a tk2dCamera in the scene, a regular Unity Camera in the scene, and with both, and I always get this error.  Any suggestions?

Thanks,
Wayne

5
Support / Re: Can't select Sprite animation
« on: September 13, 2017, 12:57:29 pm »
OK, I have installed the latest package in a new project and I don't see that problem any more.  I'm not sure if the new package fixed it or not, to be honest - by tinkering with new projects and different orders of operation last night, I was able to get it working with the old version, so I don't know if I have just been fortunate that the new version worked first time...

One problem I had with 2.5.6 that is still a problem with 2.5.8.6 is naming of SpriteCollections and SpriteAnimations.  I create a new SpriteCollection and rename it in the Inspector tab to "ThePigCollection" - indeed, if I don't, it won't let me access the editor.  But the name remains "SpriteCollection" wherever it shows in Unity - in the Assets view, in dropdown boxes, even in the Inspector if I click away from the SpriteCollection and then go back to it.  The same is true for SpriteAnimations, except that it does seem to hang onto the new name in the Inspector tab and the Animation Editor until I click "Commit" in the animation editor.  Then it reverts to a name of "SpriteAnimation" in the Inspector and in the animation editor (it has been "SpriteAnimation" elsewhere in Unity all along).

6
Support / Can't select Sprite animation
« on: September 12, 2017, 08:09:05 pm »
I am using 2D Toolkit 2.5.6 with Unity 2017.1.1f1.  I am completely new to tk2d, and no great shakes with Unity either, so I may well have done something stupid. 

I have imported a sprite sheet image into a tk2d Sprite Collection, and I can see that it has isolated the individual sprites correctly into their own images.

I have created a Sprite Animation that refers to this collection.  I asked tk2d to fill the clip with the "Autofill 1.9" button, which it did correctly.  I can click the "Play" button and see my sprite animating as I expect in the Sprite Animation editor.

So now I add a sprite with GameObject -> Create Other -> tk2d -> Sprite with Animator.  That lets me select my Sprite Collection, and it then auto-selects the first image as "Sprite", and that image is displayed underneath, exactly as expected.  However, when I try to change the "Anim Lib" in the "Tk 2d Sprite Animator" section, I see my SpriteAnimation in the drop down box, but when I try to select it, it just silently reverts to the default (first) one.  At the same time, I get this error logged in the console:

NullReferenceException: Object reference not set to an instance of an object
tk2dSpriteAnimatorEditor.OnInspectorGUI() (at Assets/TK2DROOT/tk2d/Editor/Sprites/tk2dSpriteAnimatorEditor.cs:91)

The line of code in question is this:

        if (animator.Library.clips.Length > 0)

Can you help me to understand what the problem is, or how I can find out more about what's going on?

Pages: [1]