Please Help Beginner . Overall Help

Hello,

I am 100% new to Unity and only know a little bit of Javascript. i’ve only ever used this knwoledge in creating the simplest web applications so i’ve never actually learnt about creating games with JavaScript. Anyway, I’ve downloaded all the software I need. I would like help to understand the following questions…

  1. How do I optimize the screen which is just blue and blank, to an Android screen size (Galaxy S5). Am I supposed to get a square that represents where the screen is cut off on the outside and what is on the inside shows on the device because I see no distinguishing line that shows what will be displayed or cut off? I am so confused and just want to give up but I’m trying to remain positive.

  2. How do I create a simple game where there are 5 levels (How do I create a level?). Each level will have a question up the top (how do I insert text?). Below the question will be a button that should play 30 seconds of a song. The question asks the user to listen to the song and fill in the missing words. So I’ll need a text box for user input(how do i get a text box?). I want a button underneath saying ‘check answer’ (how do i create a button?) and will bring a pop up message( How do i create a pop up alert?) telling you whether you got the answer correct or incorrect. I then want it to give you a point if it’s correct and keep track of the score by displaying it in the top right hand corner of the screen (How do I do this?). I don’t know how to use c# either so I’m freaking out as this is an important assignment I need to complete and I’m so blank to begin. I am also probably wrong about the coding required to make that comparison, something like this is what I’d guess but I don’t even know where to put these elements like in folders or what? Please help I will be so grateful.

Please, please, please help!

Thanks, Matt

Make something, that is easy. So you can learn unity.

  1. In uniy editor are Scene tab, Game tab and something other… Choose game tab, left up in the tab is using resolution (i think s5 has 1920*1080, set the resolution to that). Now you can see in game tab, how it will look on s5. (you can download android app unity remote 4 for your smartfon and use it with pc for test. read here:
    http://docs.unity3d.com/Manual/UnityRemote4Android.html

  2. use unity Ui for that.

File - new scene. You will have new scene where is only main camera

then GameObject - UI - Text, now you will have place for text in scene, move it, fill it … make something, what you will :slight_smile:

if you need button
GameObject - UI- Button. and so you have button in your scene :slight_smile:

For input, maybe input field, i didnot tryed it.

AT least you will need little script for check the result. I cannot java, only little c#.

Thanks you for your prompt answer. When I click file… New scene… Nothing happens please help. How do I move objects like the text and button around? How do I insert a screen where my logo is displayed for a few seconds before the app starts? How do I insert an image or my logo I mean. Thanks, matt

if you will move something, then switch to “Scene” tab. There are more ways for make logo.

You can make new scene. Add scene to build (file - build settings - add current).
Then GameObject → UI → Image.
Import your logo to unity (drag&drop image to assets window).
Click on Image in Hierarchy window.
In inspector window you will see options for Image. Look for “Image Script”. There is input field Source Image. Drag&Drop your Image from assets folder to this input field. You should see your picture in scene window now.

“displayed for a few seconds”

you can make c# script (right clic in assets window, then create c# script). Name it logo. Doubleclick on it, script editor will open.

using UnityEngine;
using System.Collections;

public class logo : MonoBehaviour {

    public float logoTime;
    public int levelToLoad;

    // Use this for initialization
    void Start () {
        Invoke ("logoEnd", logoTime);
    }

    void logoEnd () {
        Application.LoadLevel (levelToLoad);
    }

}

create emptyGameobject (GameObject - create empty). Choose it in Hierarchy. In inspector tab add script logo to this gameobject. Fill inputsfields from this script (logoTime (how long show), levelToLoad (wich level to load after this scene (you can see levels number in “file - build settings”. The first scene is 0, so put 1 for next scene).

if you run now the scene, then you will see your logo in game tab, thin in few seconds (logoTime), you will see error in log (there is no level 1 to load :slight_smile: ). So save scene. Make new scene and add it to build as 1. In this second scene make your gamelevel.

Thank you! How do I resize the image and centre it both horizontally and vertically? Also how would I fill in the background with the colour white in the logo scene only?

As for the next scene. Again, it won’t create a new scene??? Please help!

Thank you! :slight_smile:

Hello again, I just built and ran my project on my android device using the unity Remote App and the logo scene didn’t appear at all. Only the second scene which was Level 1 where I had a single line of text just to try it out and when I ran it on my phone it doesn’t show the logo scene and it skips to level 1 and the line of text is so small you can barely read it! I’m very confused, I don’t know what I did wrong. Please Help!

Thanks, Matt

What is the weird line also in my screen. in the image below.

with “second scene”.
do you have change logo-script in inspector ? Try set logo Time to 10. Or check script for error. The script should not have update funktion.

“fill in the background… the line of text is so small”
on your screen, up from Hierarchy are 5 small buttons. Click last with square and point in it. Then double click on Text in Hierarchy. With the 5 button on, you can make text place bigger. The same with your image (or you can choose image, go to Rect Transform in inspector, click on red cross lines and choose Resize on full screen (right down blue lines).

Hello, I don’t know how to check my code for errors. I don’t want the logo in the second scene an it isn’t which is good but everything appears to be big in the Game View but when I export to Android it’s all tiny. I think I figured out how to fill in the background. I made everything bigger but it is still tiny. It must be the resolution. I entered it in manually with the correct numbers and yet it says 183 by 326 resolution underneath still??
Is there a way I can upload all my code so that you can look at it. In scene 1 under the logo text I do have an update and I have no connection between the logo and scene two at all???I’m so confused???
I want to begin by fixing this issue with the screen size first. I’ve done everything you’ve said and everything is still bigger on the computer but still very small on the phone . Please tell me exactly every single click on how to set up android screen right from the creating a new project button please.

There’s a weird line going through my blank environment which means there’s something not right with the screen size set up. please look at the image I have attached, specifically at the blue work shop area where you will see the blue rectangle. Can you see the weird white line cutting a quarter of it out?

try this project. Click logoscene in asset

2132374–140415–Neuer Ordner.rar (177 KB)

I can’t extract the uploaded file i don’t have the right software???

i think, you will try adjust your text in wrong place.

if you add ui to scene, then you have big box up from you scene. Double click on canvas (in Hierarchy), so you can see this box. If you add text to scene, then sometimes it is somewhere in scene, but not in this big box. So drag your textObject in that box. On this box you can see, how your UI will be on display.

it was .rar archive. I will try .zip now

2132395–140417–Neuer Ordner.zip (410 KB)

I unzipped it and it cuts your logo off in the unity program should I try to export to android device?

Hello, I just ran your project on my phone and everything was tiny just like mine. There must be an issue with the resolution or screen size. I have a Samsung Galaxy S5 and you had the right dimensions earlier of 1080 * 1920. I did enter those but it still doesn’t work. Sorry but your project doesn’t work either, what do we do now?

I fixed all of the above errors THANKS! :slight_smile: Also can you pleas help me by telling me how I would code a score function that adds a point every time you click a button that checks a text fields input and compares it to the pre-set criteria.

sorry, i didnot used input fields.

you should add line to your script:
using UnityEngine.UI;

and then something like:

public InputField inputField;
public String myInput;

void Start () {
inputField = GetComponent <InputField> ();
}

void Update () {
myInput = inputField.value;
}

add this script to gameObject with fieldinput (make tag for this gameobject Input).

make ui button.

add script with lines (dont forget: using UnityEngine.UI;)

GameObject otherInput;
public String shouldBeInput;
public int Score = 0;

void Start () {
otherInput = GameObject.FindGameObjectWithTag ("Input");
}

public void  CheckMyInput () {
if (shouldBeInput = = otherInput.myInput)
score ++;
}

then in buttons editor click + (add OnClick)

choose your button in field. choose script “CheckMyInput”

but as said, i didnot used it, maybe something is wrong.

Hello @vakabaka could you please reply telling me how to add the score to a UI Text that already exists. Also how do Ikeep the current socre accross multiple scenes? Is that a DontDestroyOnLoad function.

i would use PlayerPrefs for that, so you can close your game and the score is saved.

the short version:
if you you have score (int, float), so befor you load the next level save your score with line:

PlayerPrefs.SetInt ("Score", score);
//or for float: PlayerPrefs.SetFloat ("Score", score);

PlayerPrefs.Save ();
//you dont need this line. Unity will save your score automatically, if new level loadad. But if your game crashes, befor new level is loadad, the score can be lost.

//Application.LoadLevel (level);

in next level you can make empty gameobject with script or add this in your score script

int score;
void Start () {
score =  PlayerPrefs.GetInt ("Score");
}

the long :slight_smile:

sometimes you should check your playerprefs, befor you get yor int, float… or you can get error, if there is nothing saved
i mean something like:

if (PlayerPrefs.HasKey ("Score"))
score =  PlayerPrefs.GetInt ("Score");