Tag Info

Hot answers tagged

4

The reason you are getting this behaviour is because of coordinate system. The base coordinate for your sprites is "left,bottom" (classic Cartesian) however all offsets in fnt files are assuming inverted Y axis (drawing from "left,top" of the sprite). So instead of (you may notice this gives correct align, but on the top, i.e. g goes up instead of down): ...


3

It seems that something is going wrong when you create the textures for the individual characters. First, if we look closely, we see that it's not just the o, g and 3 characters are badly positioned: As Petr Abdulin points out: The base coordinate for your sprites is "left,bottom" (classic Cartesian) which is correct. Your renderer assumes ...


3

You want your webserver access to go through HTTPS; that will encrypt the traffic so people in the middle can't read it.


3

I can't add a comment because my reputation isn't high enough, so this isn't really an answer. I thought the o's were offset differently as well, but when I used a ruler it turns out all three o's are on the same baseline. It is just an optical illusion from the dropped 'm'. In you code sample for extracting the glyphs from the font texture you use the ...


2

In my experience writing collision detection mesh-based collision (triangles versus other triangles) are the most expensive for of collision in physics engines (PhysX, Havok). Unity uses PhysX internally, so this is no different. Because each computer and platform perform differently, exact numbers cannot be provided, but generally speaking the relative ...


2

I just tested this using the following code: void OnCollisionEnter( Collision collision ) { this.enabled = false; Debug.Log( "Collided with " + collision.gameObject.tag ); } void Update() { if( this.enabled ) { Debug.Log( "Enabled" ); return; } Debug.Log( "Disabled" ); } "Enabled" was displayed until the object ...


1

Memory leaks in Unity can occur on several places. But to help you in the right direction, one of the most common leaks in unity would be the Texture/ material leaks Imperfect loops (for, foreach, while, etc) These leaks are often hard to track and can lead to crashes. To properly chase them down you first want to make sure that you have no warning ...


1

I'm fairly certain, though someone will no doubt prove me wrong, that you can not change individual elements in the mesh arrays of vertices, triangles, uvs etc. That is why when you work with procedural meshes you always update the entire array at once when you've finished modifying it. The reason for this is that mesh.uv gives you a copy of the mesh uvs ...


1

It looks like you have your score working using Time.time as the counter. I thought it may be helpful to explain what was happening when the code in your question is executed. When game starts and the Start() method runs it calls StartCoroutine (FeetScoreCounter()) When FeetScoreCounter() runs it immediately yields for one second, then after that delay it ...


1

TextMesh[] child = GetComponentsInChildren<TextMesh> (); This line (and the three after it) is always getting the first three TextMeshes in the parent object's child hierarchy - not the hierarchy of the newatom you've just created. That means that each time you create a new atom, you're overwriting the labels on the first atom you created, leaving ...


1

For states, I usually use Enums, and then do a switch statement within the Update method. Enabling/disabling components is probably easier than adding/removing them. If you need to listen for or be ready to execute a method that should only happen within a specific state, check the state at the start of the method. If the file gets too long and confusing, ...


1

The coroutine itself will pause, but the code that called StartCoroutine() will keep going. So in this case, WaitTime() will pause but OnTriggerEnter2D() will keep going. What you probably want instead is for the entire button logic to go in the coroutine. Then it won't matter that OnTriggerEnter2D() keeps going, since starting the coroutine is all it does. ...


1

Your WaitTime Coroutine will not pause the evaluation of the following code. The Coroutine will be kicked off and logic will immediately continue. Your Coroutine is waiting 3 seconds and will call that print function wherever it resides but that's all it will do. You should probably go with something like: private float triggerEnterTime = 0; void ...


1

Movement should never be dependent on framerate. Bob Nystrom wrote an excellent summary of how to write a game loop that is independent of framerate. Check it out here. He starts with the most basic game loop then makes incremental improvements, discussing the motivation behind each iteration. I've added his code here but you should really check the article ...


1

You need to separate your games logic from display logic. Game logic should run at some fixed rate (e.g. 100 ms). Display should query the state of the game and display it at unconnected rate (e.g. 10-20 ms). That way your display performance never affects the game.


1

Scripting is a subset of programming. Programming in udk means you are also creating functions, mathematical expressions, logic and conditions etc yourself. When you say you are using a scripting language then basically it means you are calling functions, creating objects, setting the resources and much more batch work and sometimes AI too. Python, perl and ...



Only top voted, non community-wiki answers of a minimum length are eligible