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

Pages: 1 [2] 3
16
Support / Instantiate tk2dSprite loses tag
« on: August 16, 2014, 10:11:33 am »
I have a tk2dSprite (a laser) that I have create as a prefab. There are four lasers positioned in opposites corners of a rectangle firing in.

I used a Rigidbody2d to push with force and isTrigger to detect on collision with the player.  This bit works well.

The problem is when they pass the player and the the lasers collide.  I have removed the laser collision from the physics matrix yet still they collide.

So I tested the layer to see what was return and see the instantiated object (the laser) is marked as "Untagged" and not "Laser" as is in the prefab.

Here is my calling code:

Code: [Select]
GameObject laser = Instantiate(Resources.Load("Prefabs/Laser")) as GameObject;
laser.transform.position = turret.transform.position;
laser.transform.rotation = turret.transform.rotation;
laser.transform.Rotate(0, 0, tempAngle);


I have even tried adding the tag in again

Code: [Select]
laser.tag = "Laser";

But no joy, any ideas?

17
Support / Re: Polygon collider and isTrigger
« on: August 13, 2014, 10:11:16 pm »
Thanks ... dragging on to scene made it appear and then applying change fixed it within my other objects.

18
Support / Polygon collider and isTrigger
« on: August 13, 2014, 08:08:38 pm »
I have followed these steps http://2dtoolkit.com/docs/latest/tutorial/creating_polygon_colliders.html for creating a polygon collider within the spritecollection but how do you make it isTrigger = true when the collider doesn't appear within the prefab?

19
Support / Re: Help needed with cross platform spritecollections
« on: August 04, 2014, 12:56:31 pm »
I see.

My mindset is working the other way. I want to think about the most powerful device and resolution and downscale but this is where the issue reside as your default position is a larger size that older devices can't accommodate.

20
Support / Re: Help needed with cross platform spritecollections
« on: August 03, 2014, 06:35:54 pm »
You can tell its a Sunday as I'm really not getting this.

The setting and switching of the assets I get now from the sample i provided.

The bit I'm not though is atlas size changes but the physical size of the sprite remains constant. One principal must be that you don't exceed 2048x2048 otherwise exceeding this with retina sizes means you can't switch easily.

Also you say "as long as your platform collections are there" but is it not the case if you are working to 2048x2048 then you don't need platform specific collections and the constants are dealt with the camera as stated. Otherwise reduction of atlas size can only be achieve through scaling.

21
Support / Re: Help needed with cross platform spritecollections
« on: August 03, 2014, 06:11:39 pm »
So how do you prepare the image file(s) to be smaller and subsequent spritecollection to ensure the overall texture size is reduced for older devices? I thought this was done through scaling the asset?!?

If I have understood you then the concept is a little foreign to me as I have come from an environment of Texturepacker (codeandweb) where the size and scale of the spritesheet is what alters not the detail thereby reducing the dimension of the spritesheet to go in to memory.
   

22
Support / Re: Help needed with cross platform spritecollections
« on: August 03, 2014, 12:31:36 pm »
Oh ok that makes sense as really couldnt see what I was doing wrong.

I had Fit to height so if you say I do Closest multiple of two that would work better.

I've changed the code in tk2dBaseSprite not tk2dSpriteCollectionData as it wasn't present in that.

The only bit I'm not quite sure of from your response is what you mean by:

Quote
You really wanna avoid changing the sprite size as that will imply changing your code and making all the visual setup rather useless.

Is this in context to the multiple sizes of the sprite across 1x to 4x?  As if so this is essential to having the smaller spritesheets and therefore manageable texturememory.

23
Support / Help needed with cross platform spritecollections
« on: August 03, 2014, 10:26:55 am »
I'm struggling to get the cross platform (1x, 2x and 4x) spritecollections working.

I have included a project (https://bitbucket.org/mygamingproject/displaycheck or download at https://bitbucket.org/mygamingproject/displaycheck/get/54ea635e3900.zip) to hopefully show the issues I am having.

I'm targeting mobile and ios5.1 so I see my three derivatives being

1x = iphone 4 (960 x 640)
4x = iPad Air (2048 x 1536)
2x = everthing else

To demonstrate the issue i am having i have used some open game art by evo (http://opengameart.org/content/2d-adventure-sprite).

The alien in this art will be the height

1x = 90px
2x = 180px
4x = 360px

Meaning the alien should consume somewhere between 15 - 23% of the height of the screen assuming in landscape.

I have a singleton that sit within a scene called "setup" that sets an object then persists throughout my scene as well as determining the ratios. This seems to be called correctly.

The issue I think i am having is the correct setup of the camera to sprite. If I setup my sprite to accommodate the alien, I click on the 1:1 button to ensure its pixel perfect and the scale drops to 0.05. The only way is remedy this is to zoom the camera scale or alter the scale of the sprite but this then doesn't work correctly with the resolutions.

The camera is prettyy standard setup as well

Native and Preview Resolution at 960 x 640 (my lowest and 1x supported resolution)
Pixels per Meter set to 20
Origin set to 1

Overrides set to

Matchby: Wildcard
Auto Scale: Fit to Height
Fit Mode: Center

I don't understand if the alien is 360px and height is 1536px the scale at 1:1 can be 0.05.  Particularly when the camera and the imported assets have been imported at the same units.

Any help would be appreciated as currently I can't ignore this issue as the texturememory falls over on lesser devices if I just go with one.

24
Support / SpriteCollection on build
« on: August 02, 2014, 07:56:36 am »
When building does only the assets in the SpriteCollection get taken over to the build or all images assets in the project?

25
Support / Re: Issue with spritesheets
« on: August 01, 2014, 10:57:32 am »
Mainly one of compression.

Images brought in to a spritecollection is around 16MB

Images put to a spritesheet in texturepacker (codeandweb) are compressed to 56KB and can be brought in to Unity2D and animator as required using TexturePacker's Importer.

When looking at build sizes the app size falls from 32mb to 15mb using the above process. 

To make use of the camera and resolution switching in 2dToolkit I need to bring in to a sprite collection but as you have mentioned this isn't recognised. But the overhead for using 2dToolkit is significant so need to find a way round this.

26
Support / Issue with spritesheets
« on: July 31, 2014, 10:48:11 pm »
I'm importing a spritesheet that I want to add to a sprite collection.

The optimisation of the spritesheet is significant performance boost so need to get this working.

All is fine and the spritesheet is imported with the following texture properties http://imgur.com/S6JGgZb

I then go to create my spritecollection but it doesnt recognise the spritesheet and gives me the error:

Asset import did not unload metadata path. This will leak memory.

I'm following these steps http://www.unikronsoftware.com/2dtoolkit/docs/latest/tutorial/importing_a_spritesheet.html and the sprite colleciton recognise the spritesheet but not the individual assets within the Unity spritesheet.

I really don't want to just use Unity2D so what am I missing?

27
Support / Re: Help needed with Camera overrides
« on: July 14, 2014, 08:19:48 pm »
OK so with one override now of

- Match by: Wildcard
- Auto Scale: Closest Multiple of Two or Fit Height
- Fit Mode: Center

This works in the main with particularly better results with Fit Height however in both instances the iphone 5 wide view "squashes" the assets. 

What would you recommend for this resolution?

EDIT: think I have sorted it as FORCE RESOLUTION was on which was skewing the view

28
Support / Re: Help needed with Camera overrides
« on: July 14, 2014, 01:50:57 pm »
I thought with Pixel Perfect you needed to do more.

For example I have created my 1x, 2x, 4x assets which are 0.25, 0.5, 1 size multipliers so not sure I follow the same physical size comment you made as they wouldn't be for optimising texture memory reasons.

If you only had one wildcard I can see that works with something like a 480x320 to 960x640 (iphone3 & iphone4s) but that wouldn't accommodate the iphone 5 would it hence the need more more overrides I thought?

29
Support / Help needed with Camera overrides
« on: July 13, 2014, 09:31:59 pm »
I am having issues with getting the camera overrides to work.

I have created the following:

- Setup Sprite collections with platform specific content for 1x, 2x and 4x
- Setup a camera and native state to be that of an iPad 3 - 4x Pixel Perfect
- Created a scene before anything else happens to determine the resolution and set the CurrentPlatform appropriately.  Its done in a separate scene to avoid any draw calls
Code: [Select]
public class ResolutionSetting : MonoBehaviour
{
void Awake ()
{
if(Screen.height <= 320)
tk2dSystem.CurrentPlatform = "1x";
else if(Screen.height <= 770)
tk2dSystem.CurrentPlatform = "2x";
else
tk2dSystem.CurrentPlatform = "4x";

Application.LoadLevel("Scene");
}
}
- I've created Overrides to the cameras for each of the iDevice resolutions (http://imgur.com/wzFBTKi)

The issue I am having is that the camera isnt being set when changing the Editor iOS prefixes.  The platform is changing but the overrides aren't/

I can't call it from my script as the camera resides in the other scene and even if I put to the game scene the awake call would be executed before the camera created.

When viewed in editor the camera doesn't change.  What am I doing wrong?

30
Support / Re: Spritesheets to import
« on: July 13, 2014, 09:20:38 pm »
OK thanks for the response

Pages: 1 [2] 3