Posts

Creating count down timer in unity by c# script

Image
 In many cases in game we have to show count down timer. in this post i will explain how to create a timer which show a timer 3... 2.... 1.....  . so first create a simple basic gameObjects :- 1. Create a new scene in your unity project. 2. Create a UI text GameObject in your scene. as I have created and named as "timer text". and set text size, position, font, color of text etc according to you need. 3. Create a new C# script. I named it as "timer". always take care that your C# script name and class name should be same. 4. Create an other empty GameObject. I named it as "timer script". and attach C# timer script with it. 5. Now open timer C# script. Add UnityEngine.UI namespace so that we can use UI component and declare a text and float of name "timer_txt" and "t". You can use any name whatever you want. I just wrote these names so that you can understand which name i have used. 6.drag and drop timer text ui gameObject into it.   the

How to change UI image by c# script in unity with example

Image
Changing a UI image with script in runtime is a quit simple thing. in many case you want to change UI image at runtime so Lets understand it by a simple example. 1. first we need a UI Image GameObject so create a UI Image Object by navigating GameObject > UI > Image or whatever steps you want to create, just create. 2. then create a c# script. and attach it any gameobject you want. 3.to replace a UI image you need refence UI image so declare a Image of name whatever you want and declare sprite for changed sprite reference. I have named Image as original_img and sprite to change as other_img. 4.Drag Image gameObject from hierarchy window to attacched script Image (named original_img) and also drag image sprite from assets folder to script sprite (named as other_img).  4. lets create a change_image() function. you can use this function or inside code to change image where you want. As we have used in start method. using   System . Collections ; using   System . Collections . Generi

Difference between unity personal and unity plus/pro/enterprise

 Unity is a great tool to create games for different platform with single code. Unity have paid and free version. Unity personal If you are a hobbyist or have low financial condition then unity personal is for you. It is completely free for creating games and you can earn money with it but it have only one condition that your organization (you) should not have earned more then $100k in last 12 months which is quit high.  Features of unity personal Core unity engine for game development all editor versions including beta versions. all platform build support. Bolt visual scripting You can use unity ads and unity in app purchase in your game limitation of unity personal organization revenue should not greater then $100k in last 12 months (including funding and other sources) Unity branding in splash screen. Don't have source code access. Unity subscriptions If your revenue or funding greater then $100k  in last 12 months then you have purchase a subscription. Unity offer three differe

How much money you can earn from a game

 Gaming industry have grown significant in last few years. A single game earn from single dollar ($1) to $2 billion per year. Gaming industry is not as simple as every one say or imagine. There are about 3 million apps in google play store and 2 million apps in apple app store. so every app or game have to compete with millions apps. For getting a good earning from a game you must work hard, create unique game,  and you also be lucky. Lets a look how much a game can earn. Game earning depends on many factor number of daily active player, player location and how much time they spend on your game. You should never estimate game earning by download because downloads and active users both are different most of the user uninstall game and it still be counted in downloads. Case study of a game earning with 100k installs  Lets take a look at game earning with 100k installs and have 60k active users and have around 5k DAU(daily active user / player which player your game per day). and 2 video

Mac vs Windows pc for Unity game devlopment

 Unity is great tool for creating 3d and 2d games. If you are thinking which pc you should use for unity so you can use any OS because unity is a program which have properties and functionalities to run. Unity is a quit heavy software so you choose a high performance cpu, and 8 GB or more RAM. Unity work smoothly in both OS mac and windows. All features are same. When you are creating a game, game will only depend on scripting, UI and other unity tools rather then on which OS running unity. Both OS have same core engine and C# scripting. OS only matter for what platform you are creating games MacOS importance Mac is only important If you want to publish your game to Apple App Store then you must have a mac for uploading your game to their store. You can not publish your game to Apple App store if you don't have a mac. In all other cases both OS are amazing. MacOS vs Windows Mac have a little better performance than windows. So if have a same hardware type windows and mac pc in that

How much Unity ads pay per 1000 impression

If we talk about how much unity ads pay per thousand (1,000) impressions it will depend on many factions lets take a look at all factors Geography (Country) eCPM (revenue per 1,000 impressions ) of a ad impression varies with countries. Countries in which impression is generated have most effect on your game revenue. We can classify these countries in two groups Tier 1 :- Countries like US, UK, Canada, Australia, France, Germany and other developed countries are counted as tier 1 countries. ad impression in these countries pay you most and an average earning per 1,000 impressions in these countries are between $3 to $8. So if you have users in these countries then you are lucky and get most of video ad impressions. Tier 2 :- Other developing and none English speeking  countries like India, Bangladesh, Nepal, Bhutan, Pakistan, Indonesia are tier 2 countries. They have quit low eCPM then Tier 1 countries. There eCPM (revenue per 1,000 impressions) is between $0.50 to $1.5. so you can se

Variables in C# script in unity

Image
There are many variables in unity some of them are usual as we use and some are created by unity API common variables are int - all you to store integer value. float - to store float value bool - give only true or false value string -   can store string value other variable are GameObject - it is used for accessing gameObject of unity AudioSource  - using audioSource as a variable Camera - use camera as a variable Using variables in Script you can define variables as <variable> <name> Like in above image i have define a public variable of type String that can store string value. if variable is public then it can be access by other script and value can be change in inspector. if nothing public or private is not written then it will be private variable. You can change variable value in inspector after attaching to a gameObject     When you create a script in unity it will work as a component and as you attach it to a gameObject it will show you all public variables can be edi