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

Pages: [1]
1
Support / Any optimization for 2018?
« on: October 15, 2018, 11:23:48 am »
I see some deprecated and obsolete-warnings in my Unity 2018.2.xxfx, are there any plans on optimising? See below:

Assets/TK2DROOT/tk2d/Code/Camera/tk2dCamera.cs(663,138): warning CS0618: `UnityEngine.Rendering.GraphicsDeviceType.Direct3D9' is obsolete: `Direct3D 9 is no longer supported in Unity 2017.2+'

Assets/TK2DROOT/tk2dUI/Code/Controls/tk2dUITextInput.cs(375,46): warning CS0618: `UnityEngine.TouchScreenKeyboard.done' is obsolete: `Property done is deprecated, use status instead'

Assets/TK2DROOT/tk2d/Editor/Camera/tk2dCameraEditor.cs(660,19): warning CS0618: `UnityEngine.GUILayer' is obsolete: `This component is part of the legacy UI system and will be removed in a future release.'

Assets/TK2DROOT/tk2d/Editor/tk2dAutoRebuild.cs(51,21): warning CS0618: `UnityEditor.EditorApplication.playmodeStateChanged' is obsolete: `Use EditorApplication.playModeStateChanged and/or EditorApplication.pauseStateChanged'

2
Support / Is there a(n easy) way to justify text in the tk2dTextMesh?
« on: March 24, 2016, 04:42:53 pm »
/topic

:)

3
Support / tk2dSprites render pink when changing scene / using LoadScene
« on: February 04, 2016, 06:21:11 pm »
Okay so here's a problem that I currently have with _all_ my projects (I'm guessing since the 5.3 update): every time I change a scene (using SceneManager.LoadScene("sceneName"); ) al lot of my sprites render pink (in fact: only the sprites where I access the material property). This is due to a missing Material in the Mesh Renderer (somehow the Mesh Renderer looses it's material). The strange thing is that when I start the loaded scene on it's own, everything works perfect. Let me explain step by step:

- If I run my "Game" scene, everything is peachy
In my Scene-view everything renders a-ok (see screenshot: GAMESceneViewNotRunning)
In my Game-view everything renders a-ok, after starting the "Game"-scene (see screenshot: GAMESceneRunning)

Now I'm currently using an "Init" scene which addresses all the properties of the camera. I'm using this scene to decide what ratio, resolution and view (landscape / portrait) I am going to use. This "Init" scene is basically an empty scene with a single tk2dCamera, and the following script:

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

public class InitializeStageScript : MonoBehaviour
{
void Start ()
{
// Set targetframe
Application.targetFrameRate = 60;

// set tk2d platform based on width or height (what's biggest)
float sWidth = Screen.width;
float sHeight = Screen.height;
float highest = 0;
bool isPortrait = false;

if (sWidth > sHeight) {
highest = sWidth;
} else {
isPortrait = true;
highest = sHeight;
}
if (highest > 1136) {
tk2dSystem.CurrentPlatform = "4x";
} else if (highest > 480) {
tk2dSystem.CurrentPlatform = "2x";
} else {
tk2dSystem.CurrentPlatform = "1x";
}

// optimize tk2d platform for platform based on maxSpriteSize
// TODO ALWAYS: change for max texture size in game (see 4x atlas in collectiondata)
// if atlas0.png in 4x folder is 2048x2048 then maxTextureSize < 2048
if (tk2dSystem.CurrentPlatform == "4x" && SystemInfo.maxTextureSize < 2048) {
tk2dSystem.CurrentPlatform = "2x";
} else if (tk2dSystem.CurrentPlatform == "2x" && SystemInfo.maxTextureSize < 1024) {
tk2dSystem.CurrentPlatform = "1x";
}

// setup level based on ratio
string prefix;
string ratio;
if (isPortrait) {
prefix = "Running in PORTRAIT mode with an aspect of: ";
if (Camera.main.aspect >= 1f) {
ratio = "1:1";
} else if (Camera.main.aspect >= 0.795f) {
ratio = "4:5";
} else if (Camera.main.aspect >= 0.745f) {
ratio = "3:4";
} else if (Camera.main.aspect >= 0.655f) {
ratio = "2:3";
} else if (Camera.main.aspect >= 0.615f) {
ratio = "10:16";
} else if (Camera.main.aspect >= 0.595f) {
ratio = "3:5";
} else if (Camera.main.aspect >= 0.575f) {
ratio = "10:17";
} else if (Camera.main.aspect >= 0.555f) {
ratio = "9:16";
} else if (Camera.main.aspect >= 0.415f) {
ratio = "9:21";
} else {
ratio = "NOT FOUND SET TO 9:21";
}
} else {
prefix = " and running in LANDSCAPE mode with an aspect of: ";
if (Camera.main.aspect >= 2.325f) {
ratio = "21:9";
} else if (Camera.main.aspect >= 1.765f) {
ratio = "16:9";
} else if (Camera.main.aspect >= 1.695f) {
ratio = "17:10";
} else if (Camera.main.aspect >= 1.655f) {
ratio = "5:3";
} else if (Camera.main.aspect >= 1.595f) {
ratio = "16:10";
} else if (Camera.main.aspect >= 1.495f) {
ratio = "3:2";
} else if (Camera.main.aspect >= 1.325f) {
ratio = "4:3";
} else if (Camera.main.aspect >= 1.245f) {
ratio = "5:4";
} else if (Camera.main.aspect >= 1f) {
ratio = "1:1";
} else {
ratio = "NOT FOUND SET TO 1:1";
}
}
Debug.Log ("Game Initialized at: " + tk2dSystem.CurrentPlatform + "  " + prefix + ratio);
SceneManager.LoadScene ("Game");
}
}

So basically the script runs on Start and decides what to do with the tk2dSystem.CurrentPlatform (and other aspecs such as ratio). In this project I only use the tk2dSystem.CurrentPlatform setup, in others I also use the ratio (to setup my scene differently for different ratios). When it's finished, it runs the next scene (which is the "Game" scene mentioned earlier).

Anyway. When running the "Init" scene, everything turns into a hot pink mess:
- The "Init" scene runs, and sets everything up. This can be seen by the Log-statement in the console (see screenshot: INITSceneRunningStep1)
- The "InitializeStageScript" runs and loads the "Game" scene, but now everything is Pinky-pink. Also the material of the sprite is missing (see screenshot: INITSceneRunningStep2)

As said, the missing material (pink sprite) only happens to the sprite that I access through the material properties (i.e.:

Code: [Select]
Material[] m = GetComponent<Renderer>().materials;
I don't get any errors, or other strange behaviour. I found this thread: http://2dtoolkit.com/forum/index.php/topic,5247.msg24038.html#msg24038 but I'm not quite sure if it applies here (I also have no idea how to fix my problem based on that thread).

Can you help? This really sucks (as it applies to all my projects :( )

4
Support / Tk2dCamera Picture in Picture effect?
« on: October 05, 2015, 11:06:44 am »
I was wondering if it would be possible to create a so called picture-in-picture effect with the tk2dCamera?
I want to run a 'default' camera over my scene and I want to have a smaller TV-like square that follows a specific target within the scene.

It seems that I'm missing something? This can't be that hard right?

This effect:


I'm already using two tk2dCamera's in my scene (one for the HUD and one for the scene) because I need to zoom in and out with the scene camera, without the HUD being affected, which works like a charm. But I can't seem to set the third camera to a single square (it renders the whole sceen by default).

5
Hi!

I've managed to create a spriteCollection that supports tk2dSystem.Currentplatform 1x, 2x and 4x. This all works great and very intuitive (thank you for that!). However I've found a small issue with my current setup:

Since I've added ALL my PNG's to the spriteCollection (including multiple background images (of 2560x1600 in the 4x category)) my spriteSize is significant (the 4x spriteSize is 4096x8192), which causes an all black game on my iPad Retina (the game runs perfectly on my iPad2 though cause the 2x spriteSize is smaller, oh the irony).

I've removed the background images from the spriteCollection and now everything runs perfectly (aside from the game not having backgrounds of course).

My question is: how can I use these backgrounds (with the 1x 2x and 4x platform-support in mind) without them adding up to the spriteCollection. Can I use SpriteFromTexture for this? And if so: how? (I've already tested this using my current setup, but it just takes the 1x version).

Keep up the good work and thank you in advance!

6
Hi guys,

First of all, amazing product, amazing service and a great experience all around. I've made a variety of 2D games with your product and it's been great since the start.

For now I am working on a TCG (a combination of HeartStone and Triple Triad) and I've run into an issue where the sprites of a card disappear when I try to rotate them. The issue is as follows:

I have a card that consists of a number of layered sprites. These sprites are layered through z-index (not through the sorting layers, ill explain why later) and the have a background, borderhighlight, title, flavourtext, some icons etc. Next to this the card has a back and a front (the idea is that I can use the card as a (pseudo) 3D gameobject and rotate them from laying down to laying up without a large hassle.

The card basically looks like this when viewed from 3D perspective:

Side (3D view) (the spacing between the sprites is slightly exaggerated)


Front (2D view)


Back (2D view)


When I rotate this card in the Y-axis a strange behaviour occurs. The front layer (the one with alle the little visuals) behaves in a really strange way. It seems that the sprites don't follow the proper camera rules (or z-index rules). This is what happens when I rotate the card clockwise (over y-axis)

45 degrees clockwise (ignore the green border, this is the same as the blue one!)


135 degrees clockwise


215 degrees clockwise


305 degrees clockwise


Strange thing is that the three back layers (the back of the card, the background of the front of the card and the edge-highlight of the front of the card) act exactly as I want them to. When I move the front layer (with all the little icons) a lot more to the front (like 100-200) it suddenly works (however, the rotation looks really weird because there is now a visible distance between the background of the card and the front layer.

front layer 100-200 to the front and 45 degrees clockwise rotation  (ignore the green border, this is the same as the blue one!)


My question is: how do I fix this? Is even possible? I've also tried to do this when the sprites are all layered based on sorting layers and then it works fine. However, in that case I have the issue that I have to make sure that all the frontside sprites are hidden when the rotation exceeds 180 (and again show them again when the rotation exceeds 360).

Next to this I will have the issue that when there are a lot of cards in the game, I have to put every card on a different sorting layer (or keep switching all the sprites to different values within the same sorting layer).

Can anyone shine a light on this (the rotation issue as well as a more easy approach to this whole issue)?

Thank you all in advance!

OUG

Pages: [1]