Using a bigger Range of colours from code in Unity

  Create a new C# script in your project called CSSColors.cs and then copy and paste the code below into it. You should then be able to use the colour names specified anywhere in your project. public class CSSColors { // NOTE: The follwing color names come from the CSS3 specification, // Section 4.3 Extended Color Keywords // http://www.w3.org/TR/css3-color/#svg-color public static readonly Color AliceBlue = new Color32(240,248,255,255); public static readonly Color AntiqueWhite = new Color32(250,235,215,255); public static readonly Color Aqua= new Color32(0,255,255,255); public static

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 for your alias. Save again. Build project. Done.  NOTE: I recently changed from a windows laptop to a macbook and had to set this up again. During that process I discovered I couldn't select the .jks key store file I had created with android.

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 course must match at step one and two. 4. Add an Audio Source component to the GameObject your script is attached to in the Hierarchy. 5. Attach you sound to the new Audio Component. 5.

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 top class, after the first { add the following code. Text message; This creates a Text object called message 5. In the Start method, add this, message = GetComponent<Text>(); this finds the first Text component and assignes it the message variable. 6.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer