Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Need help on Roll-a-Ball tutorial

Discussion in 'Community Learning & Teaching' started by Kadra, Dec 9, 2014.

  1. Kadra

    Kadra

    Joined:
    Dec 9, 2014
    Posts:
    5
    I am on "moving the camera" tutorial on "roll-a-ball". I have used all the coding the video told me to use which is as follows:

    unity help.png

    I save it and go back to the editor and there isn't a player slot for me to put the player sphere to.
    As shown here:

    unityplayer.png

    The player bit should be underneath the script according to the video.

    I hope someone can help.

    I am completely new to this and want to learn as much as I can but the coding is a bit hard to understand, so if anyone knows where I can start learning to code as well that would be greatly appreciated.

    Any help will be helpful and I hope this was posted in the right place because this is for tutorial help.
     
  2. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    not sure whats happening there, nothing staring me in the face but it is late :), but theres a couple of things i would test out first. ensure your script is saved!, as when you go back to the main editor, it does a refresh, and thats when your public slot will appear after a few seconds (little round whizzy update doomahicky icon in the bottom right)
    quit and restart unity see if that clears it up.
    if not, try removing the script, and reattach it.
    if not, copy the code into notepad, bin the script, create a new one and paste back in the code (or rewrite).

    give a wee post back, let us know if its still the same, just thought it throw a couple of things in before the unity bods see this :)
     
  3. Kadra

    Kadra

    Joined:
    Dec 9, 2014
    Posts:
    5
    I have made it work, I restarted and reattached the script and it worked. I got further into the tutorial, the video where you add the text. I couldn't find where the guitext is, so i used the UI > text instead and I couldn't get it to work.

    thanks Oboshape for the help.

    Any help on my new problem would be helpful. I did stop this tutorial but if there are anyway to get pass the fact about the GUItext, I will carry on with it.

    currently on the tutorial, Space Shooter and it seems to be going well, fingers crossed.
     
  4. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    No worries Kadra, i was going to have a look through the rollaball tute and try and give you a bit of direction.
    but when i go to view the rollaball page all i get is the Stealth tute listing :(
    are you able to view the page ok? with the rollaball tutorials listed?
    http://unity3d.com/learn/tutorials/projects/roll-a-ball

    just before I go asking the learn team.
     
  5. Antonio M.

    Antonio M.

    Joined:
    Dec 11, 2014
    Posts:
    1
    @OboShape

    I have your same problem with tutorial pages, I cannot correctly visualize them.
     
  6. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    k ill send a shout to the learn team, let them know, cheers Antonio
     
  7. Kadra

    Kadra

    Joined:
    Dec 9, 2014
    Posts:
    5
    I'm getting the same thing, they are split up into chapters with the tutorials all mixed together. what's made it go like that?

    Thanks for the help, and for trying to go through the tutorial.
     
  8. Kadra

    Kadra

    Joined:
    Dec 9, 2014
    Posts:
    5
    and I have an easy question, how do you fire the bolt for the space shooter tutorial?

    I have pressed every button on my keyboard and no luck.
     
  9. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    Kadra, there is a designated thread on the forum for the Space Shooter Project, have a quick look over here
    http://forum.unity3d.com/threads/space-shooter-tutorial-q-a.222119/

    (as a quick tip to check : have another look through the firing script and ensure everyThing is in the coRRect case, ie void Update() not void update().)

    in the meantime you can see all the tutes on youtube channel if the main learn tutorial section for videos doesnt work.

    Roll A Ball



    *EDIT* : Looks like its sorted now.
     
    Last edited: Dec 12, 2014
  10. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    Hi Kadra,

    the GUIText is still avaiable under the component menu, but i think it would be alot easier if you had a stab at the new UI stuff. but ill try and do my best to walk you through it.

    OK as far as the text goes for the rollaball, for the purposes of getting text to display during that lesson, theres only really minor changes that I had to apply to get it working.

    first off, just for the time being, press the '2D' toggle button at the top of the editor window. when working with the new UI always best to do this in 2D mode, then once your done with the UI stuff, press the 2D to switch it back off again.
    upload_2014-12-12_17-43-29.png

    ok, create a new UI text object.
    upload_2014-12-12_17-45-15.png

    you will see once you do this it will automatically create a new Canvas and EventSystem object for you, this is the defaults required for the new UI, were not going to worry about them for now, just know that any text or stuff requires a canvas for the UI elements to be attached to. you should see your text item now in the lower right, in a sort of grey text.


    once its on, highlight it in the heirarchy and rename it to ScoreText.
    from here you can see all its info in the inspector, there will be a text color picker, change that to white.
    the text displayed, currently 'New Text', you can change this so it shows 'Score Text', for now this will do as it will be changed later via script.
    your next thing you want to do is to move it to the top left, this is slightly different than before.

    with your text selected in the heirarchy, look at the inspector, and you will see the following button that doesnt look like a button at first glance. press it, and the rest of the window pops up.

    upload_2014-12-12_17-55-47.png

    so, if you hold down SHIFT key, and ALT key, and then click on the top left box thats highlighted there, it will shift the whole text and anchors to top left. then type in the offsets in the PosX / Pos Y boxes as 10 and -10.
    thats the GUI part done, youll be glad to hear :)


    ok the rest is a walk in the part if you got that long winded bit done :)


    ok , so back in your player controller script. and about 3 mins 50 into the video, where you start to wire up the new text element.

    the first change should be
    where you wrote
    Code (CSharp):
    1. public GUIText countText;
    just change this to
    Code (CSharp):
    1. public Text countText;
    this will be the same for the winText public object.

    just because its a different type of object were using. the rest of the code is the same, when it comes to making the reference to the ScoreText object in the inspector, drag over the ScoreText UI element we created.

    so now your score should display fine.
    when it comes to adding in the Win Text element.

    higlight the 'Canvas' (as i said a canvas holds UI elements), create a new UI Text object (rename it, change color etc as before). highlight it, and in the inspector, when we moved it all to the top left using the big square button thing, use the same process as before but pick the middle button to put it all to the centre.

    should all display quite happily now. and its a brief intro to the new UI.

    any probs drop a PM.
     
  11. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    i do apologise, you need the additional line at the top of the script to say your using the new UI in your script. just under the using UnityEngine, sorry :(

    put in the following just under the 'using UnityEngine;' line
    Code (CSharp):
    1. using UnityEngine.UI;