Skip to main content

Posts

Showing posts from February, 2015

Unity3d Engine 4.6 : Playing with UI Text example

Hi peeps. again. i wasted few hours to understand how to access UI object in Unity scene, in code Ok today i'm going to share with you guys, step by step okay! Our objectives here is to Have a text - display from "Hello" to "Hello World" dynamically using UI Text and C# Scripting 1. Create new scene, name it DynamicTextScene 2. Create new UI Object : Canvas, go to Hierarchy Window, right click select UI>Canvas.    3. In Canvas inspector, select its render mode to be World Space. 4. Now create a Text UI, Under the Canvas object, name it as dynamicText. 5. Now add new Button UI, under the Canvas and name it as PressButton. 6. Select the button text, change the button display text to "Press to Change Text" 7. Now select the Canvas, navigate to its Inspector, add new component script, name it as DynamicText. 8. Inside the DynamicText.cs script, code as follow. a.

Unity3D Set Image to UI Button

Hi peeps! today i made stupid mistake because i dunno !!! I learnt that unity has introduced new game object called Canvas, in this Canvas we can put on top of it UI elements. So today. my mission was to create a layout with button and its own customized image. 1. In hierarchy window, create new canvas object. 2. Select on Canvas node, right click and chose to create button. 3. Drag/import  an image to Assets folder. 4.Open the image inspector, change the image import setting, texture type to "Sprite(2D and UI)". Apply the import setting changes. 5. Click on the button, navigate to button inspector, change the source image to the image that you have just added earlier. *Its required to do import setting changes first before able to see the image populated in source image list. 6. Yes now you able to see that the button has its own customized image. well done!