Skip to main content

Posts

Showing posts from February, 2019

Unity Editor Window (Part 3)

Unity Editor Hello, Unity Dev’s I am back again with Part 3 of Creating custom editor window in unity. In today’s blog we will look around: “How to load Textures files from resource folder and create our buttons.” Step1. Gather some images related to the headers of our sub-toolbars or if you are good at photoshop create some, btw I have zero skills when it comes to photoshop so I am goanna gather images from internet. Once we have are images ready drag them into respected folder under root folder Resources. It will look something like this: Step2. Scripting   Now we need to create a function which will be called once whenever we will switch from sub-tabs. Hmmmm, so how to do that!!! First create a function and name it as per your want’s I have named mine as: “MakeWindow” Then write down these lines: Create two variables a list: to store our loaded textures an

Keyboard input in game

In any game it is essential to have a user input to control the behavior of the player. A user can give inputs either by keyboard, mouse or by touch. So for a developer it is essential to learn how to take the user input and manage your character behavior. Today we are going to learn about keyboard inputs- Taking input from keyboard is not that  tuff  all we need to do is check if the user has pressed any key, if yes do certain thing, as the user can press the key at any point of time user inputs code are mostly written in update  method. To start with today's blog 1. Create a scene add a cube and plane to it. 2. Write the following script. (Note the  difference   in  GetKey , GetKeyDown  and  GetkeyUp ). All these are input types while working with keyboard commands. GetKey -Works till the user has pressed the key. (Runs multiple times till the key is down). GetKeyDown  -Works only when a key is held down. (Runs once when the key is pressed). G