Skip to main content

Posts

Showing posts from 2014

#Unity notes: GUI.enabled

Question : i m sort of learning the facebook sdk example implementation scripts in unity. i came across this code GUI.enabled, i have no idea what it meant! so i did some experiment, base on unity documentation code. heres unity code that i did experiment with it. notice that GUI.enabled is called twice in this code. the first value of GUI.enabled is based on user click, if user selected the "Edit All Options"toggle button, then the value returned is true. second value of GUI.enabled assigned to false. After the GUI.enabled is called, all the GUI component called after it will be enabled/disabled depending GUI.enabled  value. On second call, GUI.enabled is set to false, all the component called after it will be disabled. *see the button ok always been disabled. First scenario: "Edit All Options" always been enabled, from code we can see that the GUI.enabled is been called after the edit all options toggle button created. "E

c# notes : #region

#region allows to specify block codes to be expanded and collapse convenient for longer code files. must be closed with #endregion eg:          #region FB.Login() example          public void FBLogin {          }        #endregion         expected result in editor         

#Unity note : Platform dependent compilation

consist preprocessor directives, let scripts partitioned, compile and execute a section of code exclusively for one of the supported platforms from the defined symbol we can get to know UNITY_EDITOR UNITY_EDITOR_WIN UNITY_EDITOR_OSX UNITY_STANDALONE_OSX UNITY_IPHONE UNITY_ANDROID UNITY_2_6 //unity engine version and so forth. complete information on unity help manual http://docs.unity3d.com/Manual/PlatformDependentCompilation.html

c# notes : virtual

virtual keyword used when we want to allow a method, property, indexer, event declaration to be overridden in any class who inherits it. virtual modifier cant be use with static,   abstract,   private,   ovveride example

c# notes : sealed class

sealed modifier prevents subclasses/other class inherit from sealed class. sealed modified applicable to class and methods example codes           sealed class Chair            {               public string color;               public float height;            }           we can't extend the sealed class.. eg if we try to code           class BabyChair : Chair {} //error.

Unity 4.5 set the android sdk path

Notes: I encountered some problem when building unity project. message prompted saying the android sdk path is invalid. so im gonna share. today. how to set android sdk path in unity 4.5 1. click "edit" on project menu, select preferrences  2. Select External tool, select the Android SDK location 3.For my case, i saved my android sdk in below path.  4.Test our sdk path setting by building our project. Click "file", "build settings" 5.Click on build!. build should run succesfully

#P6 Kick Start - Unity [Moving the player]

1. Create project folder 2. Name the folder as scripts 3. Create new component, new script, name it as PlayerController, the script name must be started using Capital letter. Drag the script to "scripts" folder. *change the language to c# 4. Lets start scripting! double click the PlayerController script, it ll lead us to MonoDevelop-unity, scripting editor that bundled with unity software. using UnityEngine; using System.Collections; public class PlayerController : MonoBehaviour { void FixedUpdate () { float moveHorizontal = Input.GetAxis("Horizontal"); float moveVertical = Input.GetAxis("Vertical"); //how much we want our object to move on the y-axis? nono //set to o.of float y_axis = 0.0f; //store the vector object in moving variable; Vector3 movement = new Vector3 (moveHorizontal, y_axis, moveVertical); rigidbody.velocity = movement; } } *ensure the method called Fixed

#P5 Kick Start - Unity [Adding a background]

Create a "quad" object, rename to "background"    2. Set the background properties, transform the Y-axis to rotate 90 deg.            3. As the quad comes together with mesh collider, this time we going to remove it.                                          4. drag image "nebula" from our assets folder<textures to the background object           5. Change the background object setting to fit our game screen. Change a-axis to 15 and y-axis 30 aspect ratio of 1:2                                                                                                                                                                               6. Select the "scene" tab and use frame selected "F"           7. Change the shader to unlit>texture so that the current light objects that we have doesnt affect on the background object                     8. Now we select the game tab. and we can  see th

#P4 Kick Start - Unity [Setup Camera and Lighting]

To follow this tutorial, its a pre-requisite for us to follow previous tutorials as well http://ubuntuanakramli.blogspot.com/2014/10/p4-kick-start-unity-player-settings.html In this tutorial we ll setup the camera and lighting for our game. -this game is top down style game -we going to look down the game area from above fix the game 1. we click unto the game tab button, we can see the view of our game object or ship is completely not in the position that we wanted. 2. now we re-click unto the scene tab, and press ctrl + right mouse click (to do a zoom in out) 3. ok lets us play around and press alt and change the camera orbit position 4. we can see the position of the camera now is behind the player object, select the main camera in hierarchy explorer to view our camera preview.   5.reset the transformation value of the camera by, clicking the camera transformation setting button and choose "reset". 6. Change the camera view transformation rot

#P3 Kick Start - Unity [Player Settings]

Hi peeps, lets continue from our  #P2 tutorial , now we are going to import the player object and set setting unto it. 1) Drag our ship object (vehicle_playerShip) into the hierarchy tab/ directly unto scene view 2) Inside the hierarchy tab select the vehicle object and go to the "Edit" menu and select reframe selected or F key. after that in hierarchy tab right click the vehicle and rename to player Now we can view the object at better distant. 3) Go to the inspector tab, and under Transform option, click on the setting icon and select reset. Reset function will put the object at o, o, o orientation. origin (X,Y,Z axis) 4)In order to calculate the collision between the player ship and other component we need to add rigid body component to the player ship. select add component>physic>rigid body 5) Not only that we also need to know the volume or space used by the player object in order to calculate the collision, thus we add ano