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

Unity 3 Video Training Course (FREE) - Walker Boys

Discussion in 'Community Learning & Teaching' started by profcwalker, Dec 8, 2010.

  1. m3ndi3

    m3ndi3

    Joined:
    Mar 6, 2012
    Posts:
    18
    Yay I finished Lab 01 - please check it out and play it here ... Bird BLASTER!!

    Tell me what you think :p
     
  2. johnkohls007

    johnkohls007

    Joined:
    Mar 6, 2012
    Posts:
    2
    Thank ProfCWalker for free resources :)
     
  3. Lord Herman

    Lord Herman

    Joined:
    Feb 6, 2012
    Posts:
    6
  4. pn99

    pn99

    Joined:
    Feb 9, 2012
    Posts:
    20
    Hi Guys,
    I hope to get through the tutorials for mario 2d in two more weeks to start my own game. Otherwise my wife is going to divorce me for doing this day in day out and not getting a paying job! ; )

    I'm on video #40 part 18 - 1 block breakable of mario 2d scroller, and I have a dumb question. How is that in this tutorial we are writing the block breakable script yet the blocks ALREADY have been breakable before this? I'm confused. I suppose this question only applies to the geometry breakable as the particles breakable calls the physics 'particle emitter' component (i think).

    PN99
     
  5. dayunbao

    dayunbao

    Joined:
    Jan 27, 2012
    Posts:
    14
    OK, I found a work around, but it still doesn't work perfectly.

    I've "finished" the lab, but there is a problem with either the ChangePlayerState function in the colliderAttackBox script, or the SetPlayerState function in the playerProperties script. I've triple or maybe even quadruple checked the code, and I don't see any problems with it, but when Mario hits a gumba, there's some confusion with the states. It seems that the MarioDead case is being called every time, even when Mario is big and should just change to small and not die. I've spent a lot of time playing around with the code trying to come up with a solution, but haven't had any luck. Anyone else having problems with this?

    I'd like to make a suggestion to the Walker brothers, and that is please include the completed scripts with the downloadable assets. There are a few very annoying things that happen when you don't include them. For example, every time I want to check my code I need 1) an internet connection, 2) to let the videos load (which can take a long time depending on the length of the video and speed of the connection), and 3) scanning the video for the right part that shows the code I want to check. I've spent A LOT of time doing the above to try and find what is wrong with my code, and so far I can't find anything. Also, unlike the other labs, you do not actually have a video that only shows the code. So, I've spent a few hours every day for about three weeks working through the 2D Mario tutorial, and now I'm "finished" and don't even have a playable game because of problems with the code that I can't identify, and I don't have anything to check it against...it's a bit frustrating.
     
    Last edited: Mar 7, 2012
  6. CylonToast

    CylonToast

    Joined:
    Oct 9, 2011
    Posts:
    9
    I am wrapping up the 2D mario clone now. Moving on the 3D one. You guys are Super Heroes to the Unity beginner and Amateur programmer. Looking forward to whatever you do next. I will soon post link to showcase what you have taught me. Thanks for everything!!
     
  7. ianismrt

    ianismrt

    Joined:
    Mar 1, 2012
    Posts:
    3






    I had that exact same problem, after searching around I found this bit of code:
    if(other.tag == "pathNode")
    {
    var linkToPathnode = other.GetComponent(pathNode); //get pathNode.js
    gumbaState = parseInt(linkToPathnode.pathInstruction);
    }

    "The parseInt() function parses a string and returns an integer" which just means it takes your enum text, and reads it numerically... Which I think it was supposed to do anyway... why it only sometimes works is beyond me.

    This problem drove me NUTS, but it was a simple fix.
     
  8. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    572
  9. Lord Herman

    Lord Herman

    Joined:
    Feb 6, 2012
    Posts:
    6
    I ran into a slight problem in the fifth lab (the 3D Mario clone). Some parts of the project use Unity Pro functionality, and so make error messages appear in the free edition. I've moved the offending assets out of the project folder for the time being, and removed references to them (which only appeared to be on the main camera object). Is that the right way to handle this sort of issue, or will it cause problems later on?

    For reference, the assets causing trouble were in these folders:
    Assets/Standard Assets/Image Effects (Pro Only)
    Assets/Standard Assets/Water (Pro Only)
    Assets/Standard Assets/Editor/Image Effects
    Assets/Standard Assets/Editor/Water (Pro Only)
     
  10. kodokai

    kodokai

    Joined:
    Mar 7, 2012
    Posts:
    24
    great tutorial but the sound is soooo low, even full blast :/
     
  11. Neverbe

    Neverbe

    Joined:
    Jun 29, 2010
    Posts:
    34
    Will the 2D Mario Clone tutorial work with UniTile and 2D Toolkit?
     
  12. Mikael1987

    Mikael1987

    Joined:
    Mar 4, 2012
    Posts:
    3
    Haven't done the full tutorial yet,but this by far the most complete VTC you can find on the net. Thanks a lot for this.
     
  13. guruguy00

    guruguy00

    Joined:
    Mar 1, 2012
    Posts:
    5
    I am working on the Lab 1, and I am on the Homework part of it, and not sure where to go with the 3 Count and the Flashing of the Sphere. If some one can give me a few hints that would be great.
     
  14. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
    Wow, great course we have here.

    I'm already doing lab01, and I have some "problems" with the explosions.

    I'm actually using Unity 3.5, and I've already looked into "Legacy Particles", although I've done to do the explosions via the actual way, due to the fact that when I loaded the emitter, renderer and animator from "Legacy Particles", the particles just rendered as purple cubes, instead of glowing particles.

    Also, doing it with the new particle system, I'm having some problems while trying to adjust the size of the explosion, as it doesn't work if I just try to scale it.
    I've looking every option, and the best I got is a condensed explosion via "Limit velocity over Lifetime", although it's not quite exactly what I'm looking for.

    Another current issue, is that when I set the game on "Play Mode" and destroy an enemy, an object called "prefabExplosion(Clone)" just creates into my Hierarchy tab, so if I destroy, let's say, 20 enemies, then 20 prefabExplosion(Clone) objects are created.
    My question is: Do these consume actual memory? Is there any way to actually make these disappear as soon as it's animation is end?

    By the way, when I pause and play the game again, they just disappear (to be created again, as soon as I destroy any enemy).


    Thanks a lot for the future help provided :)

    PS: Just checking the explosions video, I see a clone is created and just deleted after it's done, so yeah, it can be made. Let's see if I'm able to figure out how to do it.
     
    Last edited: Mar 12, 2012
  15. ChrisAllen

    ChrisAllen

    Joined:
    Feb 24, 2012
    Posts:
    16
    Hi Miyavi

    I've written a blog post here >>http://www.unity-projects.co.uk/shuriken-particle-system-lab-01/
    which shows the code to destroy each particle as it finishes playing through its animation

    the code to add to your particle is this


    Also with the Legacy system the reason you've got purple cubes insted of the default particle material is that you need to select it in the particle renderer

    hope this helps
     
    Last edited: Jun 10, 2012
  16. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
    Thanks for that Chris.

    My new code for auto-destruct particles is as it follows:

    However, I get a compiler error whenever I try to run it.
    If I'm instantiating an object called "explosion", shouldn't that be the one to be destroyed too?

    I'm kinda missed here.
     
  17. ChrisAllen

    ChrisAllen

    Joined:
    Feb 24, 2012
    Posts:
    16
    you need to input the code exactly as I've shown, into a new script, which you attach to the explosion prefab

    you don't need to substitute gameObject for the name of your explosion object. As long as the script is attached to the explosion prefab it will work with "gameObject" (as it relates to the current gameObject the script is attached to)
     
    Last edited: Mar 12, 2012
  18. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
    Superb!
    It's working now.
    Thanks a lot for that.

    Edit:
    _______________

    Back with another doubt.
    I want to get access to scriptPlayer.js from scriptScreenWin.js to show the final score when the time is over.

    I'm doing the following.
    The compiler keeps telling me the following error:
    Where am I wrong?



    EDIT2:
    _______________

    Oh whell, just looking for some information...
    I just achieved what I wanted by setting the "score" variable as a static one, and then getting access to it from win.js as scriptPlayer.score.

    Is this the only way to do this?
    I mean, I think I just got confused by this code
    That code is part of playerScript, and it's getting access to a scriptEnemy variable.

    Doh! We really need a CODE tag in the forums >.<
     
    Last edited: Mar 12, 2012
  19. pn99

    pn99

    Joined:
    Feb 9, 2012
    Posts:
    20
    great catch ianismrt. Holy, if it weren't for that snippit and your post, i'd be possibly stuck forever (as is usually the newbie) : ).
    THanks.

    ps. don't forget the 'Node' in 'linkToPathNode' is cap N.
     
  20. ChrisAllen

    ChrisAllen

    Joined:
    Feb 24, 2012
    Posts:
    16
    Miyavi, you can set a game object to not be destroyed on level load using the following.

    Object.DontDestroyOnLoad(myGameObject);

    you'll have to research it more as i've never used it
     
  21. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
    What I wanted to get access to is a variable, not an object.

    As I said, I managed to do it by declaring it as static, but I guess it can be done otherwise.
     
  22. ChrisAllen

    ChrisAllen

    Joined:
    Feb 24, 2012
    Posts:
    16
    I can see that.

    What I meant was that you could have an empty game object and attach a script to it which holds any variables you want to keep between scenes. (and I dont think I explained that very well)

    I guess it comes down to personal preference in the which one to use, as they both seem to do the job.
     
  23. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
    Then, those vars would have to be static too...

    I mean, let's say that empty object has a score var, in emptyObjectScript. Such var is going to be updated (according to lab01) in enemyScript... so I would have to get it from enemyScript, and the variable from emptyObjectScript would be no more than a simple reference to this one.

    I don't know if you know what I mean.
     
  24. ChrisAllen

    ChrisAllen

    Joined:
    Feb 24, 2012
    Posts:
    16
    I see what you're saying.

    Like I said, I've not really researched it at all, so you're probably correct in your approach to the problem.
     
  25. cloudn9ne

    cloudn9ne

    Joined:
    Mar 14, 2012
    Posts:
    1
    thank you!, Thank you!, THANK YOU!
     
  26. Mikael1987

    Mikael1987

    Joined:
    Mar 4, 2012
    Posts:
    3
    Are you guys on youtube?
     
  27. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
    This is it. It's done in the 2nd lab.
    In case someone else needs it, I'm posting it.

    This way, you can access to a variable set in another .js and change its value.
    In this case, it's the var life, which is set in scriptPlayer.js.



    EDIT:
    Okay, my bad....this code is supposed to say what I meant, but I've been already struggling for 30min or so... and can't get it working.

    This is the error that I'm getting.
    The GetComponent function is called correctly, so I don't know what I'm doing wrong, as my code is exactly the same as the video's.

    Just for clarification: I changed the "life" var to "lives", in case somebody is wondering if that's the problem.



    EDIT2:

    And again I'm editing.
    As looking for info, I've stumbled upon this.
    I've also something about "#pragma strict", which I don't really know what it is yet.
    But I guess it's something like strict HTML, which doesn't allow you to make some "tricks" and everything has to be severely regulated.

    So.. in the end, I have two solutions to my problem:
    1)
    Commenting the #pragma strict line and keeping the quotation marks as in here:
    Code (csharp):
    1.  other.GetComponent("scriptPlayer").lives -= 1;
    or 2)
    leaving #pragma strict uncommented (which would be the wise option) and set the following line as this:
    Code (csharp):
    1.  other.GetComponent(scriptPlayer).lives -= 1;
    Either way, it works now :D
     
    Last edited: Mar 15, 2012
  28. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
    Oh well, here I am with another problem... I don't know why this is happening, as there should be no problem with it.

    This is my code, from scriptShield:
    Code (csharp):
    1.  
    2.  
    3. #pragma strict
    4. //Shield Script
    5.  
    6. //Inspector variables
    7. var shieldStrength : int = 3;
    8.  
    9. //Private variables
    10.  
    11. function Start(){
    12.     shieldStrength = 3;
    13. }
    14.  
    15. function Update(){
    16. print("shield   : " + shieldStrength);
    17.     if (shieldStrength <= 0){
    18.         Destroy(gameObject);
    19.     }
    20. }
    21.  
    22. function OnTriggerEnter(other : Collider){
    23.     if(other.tag == "Astroid"){
    24.         shieldStrength -= 1;   
    25.     }
    26. }
    27.  
    28.  
    When I turn on my shield, it prints out "3", but whenever I hit an object, it doens't ever come down.
    Tags are well assigned.

    EDIT:
    I've changed the code into scriptAstroid.js so that when it collides with the shield, shieldStrength decrements.

    It seems to work... I just don't know why it doesn't work the first way I did it.
     
    Last edited: Mar 15, 2012
  29. pn99

    pn99

    Joined:
    Feb 9, 2012
    Posts:
    20
    This would definitely be a 'nice to have' i think as well. Personally, it's to save those hours looking over letter by letter to find your typo, when really it's a matter of doing a 'diff' to find your error. Not to say, that I'm not actually typing line by line while following along with the boys videos. I've run into code issues oh about 3 or 4 times now for the 2d mario game, all of which I've been able to find my type or the fix on the forum (that enum intParse issue around video 56 or so).

    but that's just my two cents. The walkerboys are 5 stars in my books in any case.
     
  30. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
  31. Sarnum

    Sarnum

    Joined:
    Mar 16, 2012
    Posts:
    3
    Hey there! Nice tutorial but I'm having problems with Mac OS X Standalone Unity.

    Unity App 9 (10-13) Animation Event key

    Here's Your own script called "Cube" in my project
    Code (csharp):
    1.  
    2. #pragma strict
    3.  
    4. function PrintEvent (num : int)
    5. {
    6. Debug.Log("Hello Event"+num);
    7. }
    8.  
    9. function PlayAudio (aud: AudioClip)
    10. {
    11. audio.clip=aud;
    12. audio.Play();
    13. }
    14.  
    15. function PlayParticle (par: GameObject)
    16. {
    17. Instantiate( par , transform.position , transform.rotation );
    18. }
    19.  
    20. function ChangeMaterial ()
    21. {
    22. renderer.material.color=Color.red;
    23. }
    24.  
    I have a Cube object in the scene with a Cube script

    I can make animation frames, the object moves when I press the Play animation button.

    But whenever I make animation events I get nothing

    After following the tutorial and setting up the events my cube:
    a) does not change color
    b) does not display the particle effect
    c) does not play the sound (even tho it has the sound selected in the key and sound component turned on)
    d) does not print anything to the console

    Is there anything that I'm doing wrong ? Were there any major changes from unity 3 to unity 3.5 that make those tutorial animation events not work at all ? Any workarounds ?


    Edit: Got it working properly in all projects, it started working when I did some javascript tutorials, maybe there are some project settings in unity changed there ? Anyways disregard the post and if You run into this problem just go ahead with the lessons and everything will start working sooner or later.
     
    Last edited: Mar 19, 2012
  32. dayunbao

    dayunbao

    Joined:
    Jan 27, 2012
    Posts:
    14
    Yeah, they're great. I love these tuts, and I've learned so much from them. My only point is that since it would only take about 5 seconds to include the scripts, why not do it? Every other instructional programming book or video does it.

    I'm not ruling out a typo, but I always go over my code with a fine tooth comb if there's any problem. I wouldn't post a question without first checking. I've had numerous problems related to typos while doing these tuts, but I found and fixed those myself without asking on the forum. Anyway, like I said having the finished code saved on hard drive to check against would make checking for errors 100 times easier.
     
  33. dayunbao

    dayunbao

    Joined:
    Jan 27, 2012
    Posts:
    14
    Great, thanks so much. I'll try it out soon!
     
  34. tra2002

    tra2002

    Joined:
    May 11, 2011
    Posts:
    142
    I think they are setup perfectly for a good learning experience. I learned a lot from these and the couple times I messed up a script with a typo or was totally confused on what they was talking about I went to searching the internet for a little more information.

    I think providing the scripts would not teach very well. People would just download the scripts and try get them working without learning anything. The scripts would not make for the best learning experience in my opinion. And of course this is my 2 cents since most of what I learned came from these tutorials.

    Walker Boys did a great job and put a lot of time into these tutorials and videos all a person has to do is actually put in their time to learn them properly. Not only go through them but actually use everything they teach. Not supplying the scripts makes it where the ones that want to learn this will and not just watch the video and add a script to an object.
     
  35. Sarnum

    Sarnum

    Joined:
    Mar 16, 2012
    Posts:
    3
    Hey guys, I'm doing the first project now and I'm wondering how to destroy a particle effect using shuriken. There's definitely no destroy switch there and calling the destroy function just calls up a general unity error.

    I'm trying something like this
    So, I know that my explosion is not alive anymore and I'd like to destroy it:
    Code (csharp):
    1.  
    2. if(explosion  explosion.particleSystem.IsAlive() == false)
    3. {
    4.     //I'd really like to have a way of destroying the explosion
    5. }
    6.  
    when trying to just destroy the object 10 seconds after spawning the explosion I get
    Code (csharp):
    1.  
    2. Instantiate(explosion,transform.position,transform.rotation);
    3. Destroy (explosion, 10);
    4.  
    "Destroying assets is not permitted to avoid data loss"
     
    Last edited: Mar 21, 2012
  36. tra2002

    tra2002

    Joined:
    May 11, 2011
    Posts:
    142
    @Sarnum I could be wrong but I think might work is attach it to a empty game object then make it a prefab and then use the prefab since you can destroy the prefabed object.
     
  37. Sarnum

    Sarnum

    Joined:
    Mar 16, 2012
    Posts:
    3
    Last edited: Mar 21, 2012
  38. lordnovas

    lordnovas

    Joined:
    Aug 30, 2011
    Posts:
    13
    Could anyone give me a tip for one of the assignments in Lab 1, its listed below:

    "Counter - 3 second countdown for the Sphere before disappearing"

    Do I need to create a new enemy script to give the Sphere a 3second timer before disappearing
     
  39. dayunbao

    dayunbao

    Joined:
    Jan 27, 2012
    Posts:
    14
    Like I said before, it's common practice to include the completed code, and anyone with a modicum of maturity and who is actually interested in learning scripting will not just copy and paste the code. Putting everything in the videos does't guarantee that no one will "cheat." I could just skip to the end of a video, pause it, type out all the code without listening to the explanation and not learn anything. Including the completed code is for debugging purposes.
     
  40. Michael Kolesnick

    Michael Kolesnick

    Joined:
    Mar 24, 2012
    Posts:
    1
    Thank you so so so much!

    These are gold. I am new to Unity. I went through a few of the UI videos, and now going through Mario 2D clone. So far I can tell you, they are absolutely amazing. I didn't have any problem following you in JavaScript, even though I have never used it before. I'm planing, when I'm done with the tut, to repeat it myself in C#, just to test my knowledge.

    Again thank you for sharing your knowledge. I really don't know how to express my gratitude, but you are awesome!
    These are extremely well put together. Your voice sounds pleasant too :)

    Great job!
     
  41. cmasterenko

    cmasterenko

    Joined:
    Jul 10, 2010
    Posts:
    67
    You don't need a new enemy script, just take a look at Destroy in the Unity scripting reference, there's a way to delay the destroy in there.
     
  42. lordnovas

    lordnovas

    Joined:
    Aug 30, 2011
    Posts:
    13

    Ahhh that makes sense, thanks a bunch.
     
  43. Raybrand

    Raybrand

    Joined:
    Feb 6, 2012
    Posts:
    98
    hey in the 3d mario does it show how to transfer animations from one old model to the same model but newer in unity, or a way to set the animations in 3ds max so when exported its instantly read? I herd there was a way?

    can someone please help as I have no idea what more ideas I want to implement to my character models in the future and it seems stupid that if I import the same model but with one tiny change I have to set up my animation table again.
     
  44. Oldham97

    Oldham97

    Joined:
    Jul 20, 2011
    Posts:
    100
    i have been following your lab tutorials and i just completed lab 1 and i am now on the homework part but i have a problem that i cant find the answer to how could i make the cube move around in the scene automatically and randomly but still in the view of the camera i tried many time and all i have came up with is creating a lerp but that only lets the object move from one place to another can some one help and point me in the right direction please??
     
  45. pn99

    pn99

    Joined:
    Feb 9, 2012
    Posts:
    20
    Hi WalkerBoys,
    Still love'n it : )

    I'm working on my own game now but using Mario2D as my guide.
    I'm at the point of video "part 4 - 3 player properties playerStates" where I'm creating the enumeration of player states.

    Following along with the video, when I check off 'Change Player' in the inspector my player is supposed to shrink using the Vector3 transform.localScale 'method'. In your example Mario shrinks to 0.75 in Y axis. My character however completely disappears, leaving a tiny 'dot'. My object is a 3D object though. I'm wondering if perhaps it's collider somehow hits another object upon transform and is being destroyed?

    Help!

    Thanks so much.
    PM99
     
    Last edited: Mar 29, 2012
  46. pn99

    pn99

    Joined:
    Feb 9, 2012
    Posts:
    20
    I think I found it.... but only partially solved...
    My plane was below a rectangular surface I was using and as I suspected somehow, upon shrinking, the collider slips through my rectangle and fell below to the plane (I've never understood what is the plane for but am beginning to). And so my my player is there, just very small for some reason. I suspect it's because of scaling and the objects actual size. It's roughly 30cm diameter.

    So it no longer falls through my rectangle because I've moved up my plane to the top as my surface, however, my player still shrinks to a very small size EVEN if I user a Vector3 (1,1,1).

    What gives?

    UPDATE:
    I messed around with the scale factor and found 20 worked nicely. Although it doesn't make sense, as you normally use fractions to reduce things.

    Here are my object properties:
    Actual Size:
    x: 0.3, y: 0.3, z: 0.08 (so presumably this means 30 cm x 30cm x 8cm) ps. these are actual measurements using a neat little script that measures actual objects dimensions.
    Scale:
    x: 30, y: 30, z: 22

    Anyone have any ideas why my shrinking is peculiar??
     
    Last edited: Mar 29, 2012
  47. myka

    myka

    Joined:
    Jan 9, 2012
    Posts:
    71
    Yes just what i needed !!! :d
     
  48. boisk

    boisk

    Joined:
    Apr 1, 2012
    Posts:
    2
    Any idea why mario is elevating a little when he's getting a coin from Tutorial 11 (Mario 2d project). Is this happening to anyone else? I'm using 3.5 btw.
     
  49. TTkJonas

    TTkJonas

    Joined:
    Mar 21, 2012
    Posts:
    28
    Maybe your "Coin" is Set to the "Grow" item in the inspector. That happened to me in Tutorial 11 ;-)
     
  50. einfopedia

    einfopedia

    Joined:
    Apr 4, 2012
    Posts:
    28
    nice article.