Unity3D: JavaScript->C# or C#->JavaScript access
Posted by Dimitri | Dec 18th, 2010 | Filed under Featured, Programming
When programming for Unity3D, there are some cases where we need to access a script written in another programming language that isn’t the one we are currently using. Although it is highly recommended to convert all scripts to the same one, it is useful to know how to access a C# script from a JavaScript class and the other way around.
The first thing to do is place the scripts in the correct folders in your Project tab. The script you want to have access must be inside the Standard Assets or the Plugins folder. The other script has to be placed outside these folders. After this step, just call the GetComponent() method as any other Component. Here’s a JavaScript example: Continue reading: “Unity3D: JavaScript->C# or C#->JavaScript access”
Android Manifest File for a Game
Posted by Dimitri | Dec 15th, 2010 | Filed under Programming
Android was designed to see every application as a collection of Activities united by intents. It also relies on the Activity stack to determine what Activity will be launched after the user finishes it by pressing the ‘back’ button. While the stack system is helpful for users and for some applications, this default behavior isn’t a necessarily a good thing for games.
That is mainly because of two things: a game use a lot of hardware resources from the device that runs it, meaning that having other activities in the same stack as the game Activity can have an impact on its performance. And the stack default behavior could lead to multiple instances of the same game running in the same stack.
Continue reading: “Android Manifest File for a Game”
Unity3D: JavaScript vs. C# – Part 4
Posted by Dimitri | Dec 12th, 2010 | Filed under Featured, Programming
This is the 4th post of a series that tries to explain the main differences between JavaScript and C# when programming for Unity3D. In this post, some differences between yielding (pausing) code execution in these two programming languages will be pointed out. Before continuing, it is highly recommended that you read the first, second and third other posts of the series.
As explained before, yielding pauses the code execution, being very useful to game programming, as you have a better control when things will happen in your game. Whether using C# or JavaScript in Unity3D, one can’t simply yield the Update() method. There is a workaround for that, but as you might have guessed, they are different for the two programming languages we are discussing. Since these workarounds are often used, they will be the examples presented on this post. Let’s start by seeing how to yield a JavaScript code: Continue reading: “Unity3D: JavaScript vs. C# – Part 4”
TA3D: Total Annihilation in 3D
Posted by Dimitri | Dec 9th, 2010 | Filed under Retro Games
Total Annihilation is a strategy game released back in 1997. It is one of those games that can make you forget about the time, even if played today. The original version is fun and complete, but what if you want to play it with 3D graphics? That’s why there is TA3D, (Total Annihilation 3D) which is a source port of the original game.
TA3D, as you might have guessed, makes it possible to play Total Annihilation with 3D graphics and some other improvements. For comparison, here are two screenshots, one is from the original game, and the other is from TA3D:
Continue reading: “TA3D: Total Annihilation in 3D”
Android: Changing the ‘back’ button behaviour
Posted by Dimitri | Dec 7th, 2010 | Filed under Programming
Sometimes, when programming Android applications, there is the need to assign another behavior for the ‘Back’ button that isn’t the default one. Although not recommended, there are some cases that changing the ‘Back’ button behavior is necessary, such as to avoid accidentally finishing the current Activity.
For example, a text editor, should confirm if the user really wants to quit without saving the current changes, or a game, that check if it is the player’s intention to forfeit the current game session.
So, to start changing the ‘Back’ button, behavior, you need to override the onKeyDown() method and than check if the desired button has been pressed: Continue reading: “Android: Changing the ‘back’ button behaviour”