Skip to main content

Posts

Showing posts with the label game development

Question about a component?

There is alot in Unity to learn. So the makers of Unity decided to be awesome and put full explanations of what each component does. When ever your in question of what something does. Just click the question mark in the top right corned of the component in the inspector pane.

'Building' Your Game

**A brief overlook** Unless your games only going to be made up of 1 scene, your going to need to mess with your build settings. Start with going to: File>Build Settings... or by pressing Ctrl+Shift+B Scenes In Build contains all the scene that will be made in the game when you click build. The number next to the scene name is how you would reference in the script. Platform window contains all the platforms you can build for. XBox360 and PS3 need contracts though. I don't know how to obtain those. The default platform when you start a new project is PC and Mac Standalone.

Making music.

Well. I found a nice little site that will let you create your own music for free. Then download the music file to your computer. Not a cent. Unfortuantly everything I make sounds all techno XD But it can be useful. There editor looks like this. You don't even have to download it. It just loads right in your browser Here's the link

Unity's Available Prefabs.

Unity has on their site free packages and extentions you can download and get amazing prefabs. Such as this explosion prefab.

Collision/Trigger

An overview of how to use OnCollision and OnTrigger functions. Which almost all games have. Ha..

Tags ^.^

Small Tip... Something that has been helpful to me is tags. What you do is set a game objects tag to something specific, to access them easier in a script. To set a tag, simply select the game object and in the inspector pane, click and select =D that easy.

How to Instantiate!

When you instantiate something, you clone it, put it in the position you want, and the rotation you want. A very simple command. Done like this: function Update(){     Instantiate(transform, transform.position, transform.rotation); } So basically what this script does is clones what ever the script is attached to at the position of the object, and its rotation. Not really the best thing. Better yet it's in the Update function, which is being called every frame thats rendered, so thats allot of clones ha..

Don't Destroy On Load..

So if you want to keep an object or script that keeps up variables (or for any other reason) when you go from scene to scene, you need to attach a don't destroy on load static function, which goes something like this: function Awake () {     DontDestroyOnLoad (transform.gameObject); } The Awake function is call only once, when all the objects in the scene have been created. Read more about it here . DontDestroyOnLoad  has what ever is in the ( ) to not be destroyed when creating a new scene. (transform.gameObject) is what will not be destroyed when the new scene is loaded, in this case, it will be the game object and all it's children the script is attached to.

Referencing another script..

So, here's how it's done. function addingExp(){     var level = gameObject.Find("Player").GetComponent(Level);     level.experience +=50; } Explanation: gameObject.Find("Player")  Finds the object the script it attached to. Player is the name of the object, note that the name has to be in quotations. GetComponent(Level) Finds the name of the script. level.experience +=50; level is calling the variable that we just set above, experience is a variable within the script that were calling on in the code.

What Is A Float And Integer?

Float is short for floating point which is a decimal value (example: var three : float = 3.14. An int (integer) is a number without decimal (example: var three : int = 3. Basically they are the two user variables used together with calculations. Basic text is called a string which is set by quotations (example: var three = "3". To convert between them you can use: numberVariable.ToString() parseInt(stringOrFloatToIntVariable) Mathf.RoundToInt(floatToIntVariable) <- (this one has lots of options) Special Thanks to save

Making your materials A little more realistic.. (Normal Maps and Bumped Diffuse)

How to go from this: To this:

GUI Basics

So every game has some type GUI (graphic user interface). The best way (as I see it) is scripting the GUI. Very simple, so something easy to start with: function OnGUI(){ GUI.Box(Rect(10, 10, 90, 90), "Hello!"); } Rect - Shape the box will be, rectangle. (10, 10, 80, 90) 10 - How far away it begins from the left of the screen. 10 - How far away it begins from the top of the screen. 80 - Total width of rectangle. 90 - Total height of rectangle. "Hello!" - Text that shows up in the box.

Input Character Controls?

When creating controls for your players to use, It's needed (or really just helpful) that you modify your Input settings.

Let there be fire =D

Creating a mediocre fire effect on Unity 3D . Start by clicking create>Particle System under the Hierarchy Pane.

Making Classes..

A dip into JavaScript. Before I begin. var is a variable. You need to declare your variables before you start writing code so the code will execute properly. Declaring a function goes like this: function Update(){ //Insert your code here.... }

First Blog...

Well, its going to be about creating games on Unity . I am relatively new to the interface and JavaScript. But I have gotten used to it through great tutorials and scripting references . I am going to be developing a simple (or at least at first.) video game, and keeping track of it on this blog here. Unless your at least relatively familial with Unity, you might want to watch all the tutorials (Yes I know its alot) to understand exactly what I am talking about.