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

Pages: [1]
1
Support / Re: 2dtk + Vectrosity (UnityUI) - Scaling
« on: November 26, 2015, 12:08:10 am »
Hi Folks,

Spent some time and compromised by setting the canvas mode to 'world' and then adjusting the canvas size to match up with the 2dTK camera.  I lose the ability to add/edit lines in the Unity editor but for now that's not an issue for what I'm after.  Since the lines are part of the game world I wanted to use the same co-ord system which this seems to allow.  In fact this allows to make a Unity UI in general scale using the 2dTK scaling as well which I've been wondering how to do as well.

All I did was set the canvas rect transfrom position to the same pos as the 2dTK camera, set Z to something higher than the 2dTK camera Z and width and height to the 2dTK screen extent width and height.  Be interested to hear if anybody else does this kind of thing and how they have approached, cheers.

Pete

2
Support / 2dtk + Vectrosity (UnityUI) - Scaling
« on: November 24, 2015, 04:59:07 pm »
Hi All,

I'm using 2dtk with a 2dtk camera that has an override set to 'closest multiple of two' which works great for retro 'pixely' type stuff.  I'm also just starting to use the gold standard line drawing asset 'Vectrosity'.  Line drawing takes place using a UnityUI canvas in Screen Space Overlay mode.  Vectrosity only allows the Screen Space Overlay mode.  I see I can use the Canvas Scaler component and emulate 'Fit Width' and 'Fit Height' to match up to the same overrides the 2dtk Camera has but what about 'closest multiple of two' so I can maintain the same scale for both game and UI in general?  Any ideas?  Please bear in mind I started to learn Unity a while ago but had to stop because life got in the way and I'm only recently getting going again so my understand might be wrong of how I'm approaching this!

Thanks all, really applicate any help I can get.

Regards

3
Support / Physics and pixel positioning
« on: January 16, 2015, 10:07:37 am »
Hi All,

I would like to position my sprites by pixels and not units if possible.  I know I can adjust the pixels to units setting from the default of 100 to 1 to achieve this but I want to use physics as well and this won't work well then.  Is there any sort of scaling feature or similar in 2DTK that can help, or do I need to write a bit of code to work this out every time I re-position something?

Many Thanks

4
Support / Mixing Unity UI?
« on: November 27, 2014, 03:56:14 pm »
Hi All,

Just thought I'd try out the Unity UI tools in 4.6 alongside 2D Toolkit.  I see some odd things like when I scale the Game View it doesn't seem to work right when I have a button setup to scale to its parent container for instance.  It might be my understanding however as I literally had a 15 min 'play'.  Got me thinking about camera overrides and the like and I'm starting to think sticking with the 2D Toolkit UI might be a better option?  Anybody chime in on what they do?  To be fair I'm only thinking some simple buttons at the moment but you never know.

Pete

5
Support / Re: Performance Question
« on: October 03, 2014, 10:50:53 am »
Hi,

Many thanks again for the reply and advice.  I agree I can't see any 'real world' use case for what I've been replicating.  I was merely using it as a learning exercise and also interested in how I could optimize things (if at all) to get me some good grounding for later on.

Thanks again, great product and support by the way.

6
Support / Re: Performance Question
« on: October 02, 2014, 11:10:02 pm »
...an also whether my approach looks ok.  Am I positioning things the most efficient way etc.  Bear in mind Unity is very new to me so any advice or pointers are welcome :)

7
Support / Re: Performance Question
« on: October 02, 2014, 11:07:44 pm »
Many thanks for the reply.

I did wonder if there was some sort of Unity overhead with the Game Object's but had hoped by not having things such as collider's and so on it would be minimal.  I know its an Apple vs Pears comparison but but I wanted to see what can be achieved.

I'd be interested to hear anyone's thoughts on optimizing what I've done code wise (particularly in the first block of code where there's the translation / positioning stuff running on each update).  Also, if changing the shader on the prefab might help?  If I'm honest I don't pretend to understand shaders just yet fully but am aware there might be a performance hit on certain ones.

Look forward to anyone's advice.  Thanks again.

8
Support / Performance Question
« on: October 02, 2014, 09:10:07 am »
Hi Folks,

I'm really new to both Unity and 2D Toolkit and have started out on a first simple project to more or less replicate a PIXI benchmark here :-

http://www.goodboydigital.com/pixijs/bunnymark/

I have my scene setup, 2D Toolkit camera in place, a simple sprite collection made with one sprite (the wabbit :)), an empty game object which is responsible for instantiating a prefab I have made out of a simple 2D Toolkit sprite & C# script that controls the bunnies behavior, here's the script attached to the prefab :-

Code: [Select]
using UnityEngine;
using System.Collections;

public class myBunny : MonoBehaviour {

private float minX = 0.0f;
private float maxX = 9.6f;
private float minY = 0.0f;
private float maxY = 6.4f;
private float speedX = 0;
private float speedY = 0;

tk2dSprite mySprite;

public float gravity = 0.09f;

// Use this for initialization
void Start () {
mySprite = (tk2dSprite)gameObject.GetComponent ("tk2dSprite");
speedX = Random.Range (0.0f, 8.0f);
speedY = Random.Range (-4.0f, 1.5f);
transform.position = new Vector2 (0.0f, 6.4f - mySprite.GetUntrimmedBounds().size.y);
maxX -= mySprite.GetUntrimmedBounds().size.x;
}

// Update is called once per frame
void Update () {
speedY -= gravity;

transform.Translate (speedX * Time.deltaTime, (speedY * Time.deltaTime), 0);

if ((transform.position.x < minX) || transform.position.x > maxX) {
speedX *= -1;
transform.position = new Vector2(Mathf.Clamp(transform.position.x, minX, maxX),transform.position.y);
}

if (transform.position.y < minY) {
speedY = Random.Range (3.0f, 7.6f);
transform.position = new Vector2(transform.position.x, Mathf.Clamp(transform.position.y, minY, maxY));
}
}
}

...an heres the code in the simple script on the empty game object...

Code: [Select]
using UnityEngine;
using System.Collections;

public class myBunnyMarkController : MonoBehaviour {

// Starting number of bunnies to create
public int startBunnyCount = 2;

// Use this for initialization
void Start () {
for (int i = 1; i <= startBunnyCount; i++) {
Instantiate(Resources.Load("myPrefabs/myWabbitPreFab"));
}

((tk2dTextMesh)GameObject.FindGameObjectWithTag ("TextMesh").GetComponent("tk2dTextMesh")).text = "Number of bunnies : " + startBunnyCount.ToString();
((tk2dTextMesh)GameObject.FindGameObjectWithTag ("TextMesh").GetComponent("tk2dTextMesh")).Commit();
}

// Update is called once per frame
void Update () {
if (Input.GetMouseButton(0)) {
for (int i = 1; i <= 50; i++) {
Instantiate(Resources.Load("myPrefabs/myWabbitPreFab"));
}
startBunnyCount += 50;

((tk2dTextMesh)GameObject.FindGameObjectWithTag ("TextMesh").GetComponent("tk2dTextMesh")).text = "Number of bunnies : " + startBunnyCount.ToString();
((tk2dTextMesh)GameObject.FindGameObjectWithTag ("TextMesh").GetComponent("tk2dTextMesh")).Commit();
}
}
}

The codes a bit messy in the empty game object 'controller' but its only fired when starting up or if the mouse is down, I wanted to come back to it once everything else was ok.  When I run this I hit about 5000 sprites onscreen in both the Unity player and a standalone build before things start to dip below 60fps, I was hoping for a lot lot more based upon the PIXI benchmark I got the idea from as I'm seeing 10,000's running through their HTML5 renderer, any ideas folks?

Happy to post up the project in full etc but I have 2D Toolkit in use and suspect it would have to go in the private board?

Thanks all :)

9
Support / Re: Asset Import Settings
« on: March 06, 2014, 11:18:17 pm »
I think I found the info looking at the Unity docs.  Unity stores meta data regarding the original asset which I assume is the actual import settings but the raw asset is still there so I'm assuming 2D Toolkit just goes back to the raw asset and processes it as per your Sprite Collection settings which are in effect the Atlas settings.

I'm still very new to Unity so only just realised I can drop an asset directly into Unity from the file system and then sprinkle on the import settings and then continue to update it externally as long as I don't move it around the file structure at that point, handy.

Let me know if I'm way off here please, never harmful having a good idea of whats going on :)

10
Support / Re: Asset Import Settings
« on: March 06, 2014, 02:01:17 pm »
Many thanks again :)

Just for my understanding does that mean that Unity stores the 'raw' GIF (in this instance) when you import it and its that data that is used when setting up the sprite collection ?  I guess I'm trying to properly understand what Unity does when you import an asset into it.  In my tiny brain it would make snese for Unity to hold the original and then create the usable asset based on the import settings when needed i.e. switching platform / compiling etc which would allow for the per platform overides I see as well.  Am I right or totally wrong?

Sorry for the questions, I guess this is more general Unity one but ties in with 2D Toolkit... well.... a bit lol

11
Support / Re: tk2dCamera Viewable Bounds Preview
« on: March 06, 2014, 01:31:14 pm »
Sneaky :)  Many thanks, works a treat, great product by the way :)

12
Support / Asset Import Settings
« on: March 06, 2014, 12:00:42 pm »
Hi All,

I've been reading through the docs for 2D Toolkit and have been making up sprite collections, creating prefabs and instantiating from the editor / code etc and all's working great.  I just wanted to check something.

To create a sprite collection I need an already imported asset into Unity i.e. the 'Sprite'.  Whats the recommended settings or guidance here for importing into Unity?  I know that when the sprite collection is 'commited' 2D Toolkit also performs some processing (with Unity) to create the atlas so does that mean the asset is processed twice?

For instance if I have a simple circle as a GIF but I'm aiming to use 'point' filtering do I initially import the GIF as a 'Sprite' texture type (I'm using Unity 4.3.4) and then when setting up the sprite collection use 'point' sampling again in the settings there?

Sorry if this sounds a little stupid, pretty new to Unity and whilst the asset management seems excellent its a little confusing to begin with :)

Thanks

Pete

13
Support / tk2dCamera Viewable Bounds Preview
« on: March 06, 2014, 11:28:39 am »
Hi All,

I'm new with 2D Toolkit (and Unity) and am looking for a little help please.  When selecting my tk2dCamera in my scene I see a nice preview of the viewable bounds of it in the Unity editor.  There's a green box for the Native bounds and also a white box for the preview resolution.  When the tk2dCamera doesn't have the focus it disappears, is there any way so it shows all the time as its handy to see it when manually creating sprites and positioning etc?

Thanks All :)

Pages: [1]