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.


Topics - appymedia

Pages: [1]
1
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

2
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

3
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

4
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 :)

5
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

6
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]