Category Archives: Unity

Automatic Android Code Signing in Unity

Create a new folder in your project called Editor Within that folder create a new C# script called something like PreloadSigningAlias.cs Copy and paste the code below into the script and save it. Replace KEYSTORE_PASS with the password to your keystore Replace ALIAS_NAME with the name of your android alias Replace ALIAS_PASSWORD with the password… Read More »

Playing A Sound in Unity

Here’s a simple way to play a sound in Unity. 1. Add something like this to the declaration section of your script. public AudioSource audioSourceExplosion; 2. Add this line of code where you want to play the sound. audioSourceExplosion.Play(); 3. NOTE : What I have called audioSourceExplosion here is the name of the variable and of… Read More »

Changing C# template for Unity

The template files for Unity’s scripts are kept in Program FilesUnityEditorDataResourcesScriptTemplates The new behaviour script, the most common one is called (or something similar, depending on version) 81-C# Script-NewBehaviourScript.cs.txt

Getting a button to change a text object in Unity 3D

Using a button to change the text of a text object   1. Insert a Text object using Create -> UI -> Text 2. Insert a Button, using Create -> UI -> Button 3. Create a new script, using Create -> C# Script 4. At the top of the script,  add another using statement, using UnityEngine.UI; at the… Read More »