i’ve been using Unity3D on and off for a week now. i’d burned through about a dozen beginner tutorials, and am a little overwhelmed by how much i don’t know about the engine, which enables you to create 3D games to deploy to a number of platforms, including the iPhone and web browsers.
i’d look like a fool if i tried to write a tutorial at this point. So instead, i’ll share this list of translations of common Actionscript 3 coding tasks to the Unity3D engine’s JavaScript-like UnityScript language.
1. Render an Object Visible or Invisible
Actionscript 3:
thing.visible = true; // or false
UnityScript:
thing.renderer.enabled = true; // or false
2. Tint an Object
Actionscript 3:
var colorTransform:ColorTransform = new ColorTransform();
colorTransform.color = 0xFF0000;
thing.transform.colorTransform=colorTransform;
UnityScript:
thing.renderer.material.color = Color.red;
3. Get a Random Number
Actionscript 3:
var someRandomNumberBetween0And5:int = Math.floor(Math.random()*5);
UnityScript:
var someRandomNumberBetween0And5:int = Random.Range(0, 5);