Monday, 13 April 2015

Rotate on drag for Mobile

Also found the answer for "Rotate on drag for iOS" very helpful and worth noted for future reference.

Good video tutorial about Mobile input

Was looking for a better way to handle input from mobile devices and read a few articles suggesting not to use GUI. However most of the examples given are all based on GUI....

After a few round, finally found this video tutorial by Sebastian Lague which is very clearly explained, does not use GUI and the content is easy to follow. Highly recommended!

Disappointed with quality of tutsplus Unity 3D tutorials for fruit cutting

Tried the fruit cutting tutorial from tutsplus.com, and was quite disappointed with the quality. The instruction was quite unclear, the method been mentioned about positioning the first apple and clock icon on the screen using Canvas doesn't work and I can't get it to align properly, nothing been mentioned about which object should one the scripts been attached to and caused some confusion,...etc.

As this is the first tutorial I tried on their site, hope this is the only one that's not properly written, will probably give the others a try later, fingers crossed...

Thursday, 12 March 2015

An excellent Unity tutorial site

Found this cool site called noobtuts where there's lots of Unity 2D/3D tutorials (plus tutorials for C++, Python, Java and other stuffs too), I am currently learning all the Unity 2D ones and really enjoy it. Strongly recommended!

Sunday, 8 March 2015

Can't get onTriggerEnter to work in "Roll-a-ball" tutorial?

Was following the "Roll-a-ball" tutorial but can never get the "OnTriggerEnter" to work in the "05. Create pick-up objects" module.

The settings for player object is as below:

The settings for the Prefab object "Pickup" is as below:

When the "Is Trigger" for Box collider in "Pickup" prefab is ticked, the sphere/Player object just went through the "Pickup" object as if it does't exist, and "onTriggerEnter" in the "PlayerController" script (attached to the Player object) does not get called. When it's not ticked, the sphere/Player object will bump into the Pickup object and stopped.

Found this similar question in answer.unity3d.com, however it's due to typo in the "Tag" name. To avoid confusion, I later purposely renamed my tag to "PickMeUp", plus added a few Debug.log in onTriggerEnter in the "PlayerController" script as shown below. So that even if the tag name doesn't match, there should be at least a line "enter onTriggerEnter" been logged on the console when it was called, but strangely nothing gets logged...

I am on Unity 4.5.2. Both the player and Pickup objects have collider and rigidbody component added. What else could be wrong? I am totally confused....

[Update]
Asked question in answers.unity3d.com

[Update]
Question got rejected, because it should be "OnTriggerEnter", not "onTriggerEnter" - needs upper case "O", silly me. Certainly a big lesson learned.

Thursday, 5 March 2015

Unity 5 is here!

Great to hear that Unity 5 is now available for download!

With my current speed of learning, hopefully can have something published before Unity 5.5 is out... ha ha!

Any way, I believe in the 10,000 hour rule, still a long way to go, and I will certainly keep working on it, never give up!

Finished Space Shooter tutorial!

Spent some time following the excellent tutorial of Space Shooter, finally got it completed today. It was great fun creating a shooting game from scratch.

The quality of the tutorial was quite impressive, and certainly helped me to understand Unity a lot more. Strongly recommend anyone interested in Unity to give it a go.

Noticed I actually skipped a few tutorials before the Space Shooter, will certainly try to go through each of them as well. Now, time for the next tutorial...

Sunday, 8 February 2015

Which platform was it building for?

A bit confused about the "build settings" screen in Unity. As below, while the unity icon was on "PC, Mac & Linux Standalone", selected "iOS", and then click on  "Build". Question is, will the build be for "iOS" or "PC, Mac & Linux Standalone"?

By cancelling it half way through, as the red error message indicates,  it was trying to launch XCode, so looks like it's for iOS.

this.gameObject.name and Input.GetAxis

Learned that you can:
Use Input.GetAxis("Mouse X") and Input.GetAxis("Mouse Y") to get the (X,Y) of mouse.
Use this.gameObject.name to print out the object name.
Both works when running on Mac.

void Update () {        
   print(this.gameObject.name+" Input.GetAxis(Mouse X)= ("+Input.GetAxis("Mouse X")+""+Input.GetAxis("Mouse Y")+")");
}


Was going to try and deploy to iOS, but gets this warning: "Game scripts or other custom code contains OnMouse_ event handlers. Presence of such handlers might impact performance on handheld devices." so might not be a good idea then.


Hello World

Like to start this blog to keep track of my Unity3D learning experience, hello world!