Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Beginning 3D Game Development with Unity 4

Discussion in 'Community Learning & Teaching' started by k3D-Junkie, Sep 10, 2013.

  1. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129
    Hi Steambucky. I put this code into the GameManager script and it seems to have worked ok.
     
  2. steambucky

    steambucky

    Joined:
    Sep 15, 2013
    Posts:
    33
    Thanks tholland! :)
     
  3. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    @tholland- You don't need both shadow types. At the time I updated that chapter, Unity free did not have any dynamic shadows. In a later release, they made dynamic shadows available to everyone. But, shadows are very expensive, and the blob shadow is valid alternative when trying to keep your resource use low- as for mobile. If I didn't already, I need to add a note about turning the regular shadow casting off on your light for that section.

    @ christinanorwood - You could certainly get away with not having a lockplate if you kept the sequence simple- click lid with key, key goes into lock and turns, lid is unlocked. Click lid , it opens, click lid again, it closes, click key (if lid is closed)it comes out, else nothing happens. If you want to make it more realistic, as I think I did in the first book, adding a lockplate allows you to have the player put the key into the lock, and then have to actually click it again to turn it, toggling its locked/unlocked state. To remove the key, you need to differentiate between turning it, so the lockplate provides an extra object to pick. I've made versions of the chest where turning the key in the lock when the lid is up, raises the catch, so the lid can't close all the way :)

    Also be aware that you could put all of the logic into a single script to control the chest lid- it would probably be quicker and easier, but then it wouldn't tie in to all of the functionality that you are setting up to handle action objects generically (mouseover highlighting, distance based, distance checks for picking, auxiliary actions, etc)

    Sue
     
  4. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129
    Hi Sue

    I'm now on page 338. The rock animation no longer works. When I click on the rock I get an error message "The animation state rock move could not be played because it couldn't be found!" The animation clip is included in the animations list of the AnimationObjects, so I don't know why the error is happening.
     
  5. gary.gan

    gary.gan

    Joined:
    Nov 13, 2013
    Posts:
    12
    Hi Sue, great book. Keep it up.
    More pictures on steps would be nice enhancement

    Is it part of the "Animated Objects" group?
    is it right inside the "chest base" object in scene view, when unveil the chestlid?


    Any chance to update the errata here, to centralize?
    http://www.apress.com/9781430248996
     
  6. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129
    I put it in the Animated Objects group as an object in its own right, and that seems to work
     
  7. gary.gan

    gary.gan

    Joined:
    Nov 13, 2013
    Posts:
    12
    thanks. Just curious why I couldn't locate it in the 2.6G sample code
    Is it obsolete?
     
  8. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    hi Gary,

    The "Lockplate" object has no mesh, so it wasn't something that needed to be imported. By creating it in Unity with a cube, then turning off its mesh (or removing its mesh component, you are left with just a a collider- which is required for a pick event. You could also create an empty GameObject and add a Box collider to it.

    As far as positioning, it needs to stick out from the chest base's collider so that it, not the chest base is picked first.

    Could you have used the chest base for the pick to unlock the chest? Yes, but that would mean you could pick anywhere on the chest base which makes less sense and could leave hte player on the wrong side to see it open.

    hope that helps,
    Sue
     
  9. gary.gan

    gary.gan

    Joined:
    Nov 13, 2013
    Posts:
    12
    Thanks Sue.

    FYI, there's an errata in pg338, not sure if this is mentioned before:

    supposed to be:
     
  10. pauL___

    pauL___

    Joined:
    Nov 28, 2013
    Posts:
    14
    HI everyone..Im newbie here.. just finished reading until chapter six of unity book of Ms. Sue Blackman.. My problem is that i cant find "From the book’s Chapter 6 Assets folder," and all other..its seems like i cant find downloaded book assets.. Please help on my issue..
     
  11. christinanorwood

    christinanorwood

    Joined:
    Aug 9, 2013
    Posts:
    402
  12. John-Lisenby

    John-Lisenby

    Joined:
    Nov 8, 2013
    Posts:
    121
    Hi,

    When I open up Chapter 7 Start scene I am getting error message "Assets/Adventure Scripts/Interactor.js(47,53): BCE0120: 'GameManager.navigating' is inaccessible due to its protection level." I am using Unity 4.3, and I am not sure if that is the problem or not. Still learning Unity. See my screen shot https://dl.dropboxusercontent.com/u/42533148/Screenshot%202013-11-28%2010.38.33.png How do I fix this error?

    Thanks,

    John
     
    Last edited: Nov 28, 2013
  13. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    hi John,

    Are you using the latest edition of the book? (does it have a small character on the front cover?)

    I see a bunch of 'private var' in the script in the screen shot. Unity changed private to be inaccessable in the usual ways, just replace private with internal and it should be good.

    If you are using the first edition of the book, I've listed the errata in the first post on its thread.

    Sue
     
    Last edited: Nov 28, 2013
  14. John-Lisenby

    John-Lisenby

    Joined:
    Nov 8, 2013
    Posts:
    121
    Hi Sue,

    I am using the second edition here is the link from Amazon. should I redownload the assets?

    Thanks,

    John
     
  15. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129
    Hi Sue

    I'm still stuck on page 338 (see my message of four days ago); how do I reattach an animation?
     
  16. John-Lisenby

    John-Lisenby

    Joined:
    Nov 8, 2013
    Posts:
    121
    Hi Sue,

    I got it working! Some how I must have downloaded the old book asset files.

    Thanks again,

    John
     
  17. gary.gan

    gary.gan

    Joined:
    Nov 13, 2013
    Posts:
    12
    isn't it inside the 2.6GB:
    "9781430248996.zip\9781430248996\Beg Game Dev with Unity 4.x Assets2-6.zip\Chapter 06\Assets06\"
     
  18. gary.gan

    gary.gan

    Joined:
    Nov 13, 2013
    Posts:
    12
    Hi Sue:
    on pg281, new clip "Key Up" is created.
    Is it added to the 8th element of the "AnimationObjects" automatically when creating new clip?
    $AnimationObjects.png

    I am using Unity v4.3, creating new clip looks a bit different.
    and when i was in chapter 10, I found the "Key Up" animation is needed to be on "AnimationObjects".

    I am using Unity v4.3 the 2.6GB project seems has problem on opening an old version project
     
  19. tetsii

    tetsii

    Joined:
    Nov 12, 2013
    Posts:
    5
    Hey!

    I have recently started out with this book and I've bumped into a rather annoying problem which I am not able to solve:

    On page 280 we add an animation component on the KeyAtRock. I have KeyAtRock selected in hierarchy but yet when I press cmd+6 (or window->animation) I get an empty animation window. I am able to add the transform->position.y manually, but the transparency thing is causing a problem. I'm okay with adding stuff manually, but why doesn't my cmd+6 or window->animation add all the animation variables automatically? I have tried almost anything, but I am not that good at unity so finding an answer to this is hard alone..

    - Teemu

    PS. Oh yeah and here's a screenshot. It even looks waaaay different for me (yeah I got the newest version of Unity tho..)
    $Screen Shot 2013-12-01 at 12.44.46 PM.png

    PPS. I noticed I've been using the spec color in this one. Main color doesn't work either so the problem still exists.
     
    Last edited: Dec 1, 2013
  20. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129
    Hi Tettsi
    At the bottom left of the animation screen are two buttons;press "curves" and you should then be able to access the animation details
     
  21. tetsii

    tetsii

    Joined:
    Nov 12, 2013
    Posts:
    5
    Thank you for the reply.

    I am able to edit the curves fine, yes. But as you can see, I don't have the values on the left column automatically as seen in tutorials and in the book. I have been browsing the forums and it seems it's a "feature" in the new Unity 4.3 version. Is there a possibility to have all of the attributes appear on the animation window automatically like the older version used to do?

    So my problem here:
    - Attributes not popping up automatically (yes I have KeyAtRock selected and cmd+6)
    - I add the curve in manually and change the material to transparent "Yay". However, while in the animation window the curve is the only thing going from value "1" to "0". Nothing happens. The curve is 1->0 but the value itself does not change. Odd.

    The screenshot taken by Empedokles below explains the situation quite well.
     
    Last edited: Dec 3, 2013
  22. Empedokles

    Empedokles

    Joined:
    Dec 3, 2013
    Posts:
    2
    Yea, same here - transparency stays always at 1, (see screenshot $Alpha.jpg ) though the curve is at 0. Updated to 4.3 as well - looks like a bug to me.
    However - if I open the project from the book download with version 4.3 the transparency works fine.
     
    Last edited: Dec 3, 2013
  23. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    @Empedokles- if the transparency doesn't change on the object, double check to make sure the shader is from the Transparency sub-menu!
     
  24. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    Hi Tony,
    sorry to be so long on your lost animation prob.

    Since that was an imported animation,
    1- I would first drag a new AnimatedObjects asset into the scene delete all but the rock test that
    2- if it still can't find the animation, I would go back to the imported asset, change its Rig type to something else, then change it back to Legacy
    3- then you probably need to try step 1 again

    I don't think I've found a trick to "find" it

    hmmm, wait, maybe drag the animation clip from the imported asset directly into the animation array?
    try that first rather than grabbing it from the browser

    I'm finding that Unity isn't clearing all traces of earlier imports when something is re-imported, I've now had to import some assets with a new name to have a proper update. If I delete SomeObject from the Project, reimport the fixed version as SomeObject1, it works. Then, if I rename that asset to SomeObject, it reverts back to the original's incorrect behavior!

    Anyway, sorry I haven't found a good solution. Unity wants us to change over to Mecanim, but has yet to provide a streamlined workflow for a simple animation trigger.

    Sue
     
  25. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129
    Hi Sue

    Thanks for this. Sadly none of it works! But I have a couple more questions:
    In the Animation screen the left hand column of objects with their transforms are all listed in red; what is the significance of this
    I get a warning message from time to time "Unable to open Assets/AnimationTests/AnimationObjects.FBX. Check external application preferences" - what does that mean?
     
  26. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    Sounds like maybe the AnimationObjects.FBX file has gotten corrupted
    which would explain a lot
     
  27. mike274

    mike274

    Joined:
    May 24, 2012
    Posts:
    16
    I'm on page 583 of Chapter 16. Step 13 says to add matching normal maps for Gimbok and Kahmi. I'm not finding their normal maps anywhere in the Resources Files that have been provided. Am I looking in the wrong place? All I see are the the texture maps.
     
  28. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    Hi Mike,

    I just checked my old resources files didn't find anything.
    Apparently I forgot to make and add them myself- my bad!
    If you want, you can duplicate the texture maps and change them to normal maps in the Inspector

    I'll add that to errata in he first post when I get a moment

    Sue
     
  29. mike274

    mike274

    Joined:
    May 24, 2012
    Posts:
    16
    Ok! That's what I'll do. Thanks for the super quick response, Sue!!
     
  30. joedgrant

    joedgrant

    Joined:
    Mar 16, 2010
    Posts:
    23
    Hi Sue,
    Just picked up the new edition. It's a great refresher course. We use unreal at work, so a lot of what I picked up from the first book has atrophied a bit.
    I've wanted to make an adventure game for years... though every gig I've gotten has been for a first person shooter.

    Thanks again!
     
  31. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129
    I've deleted AnimationTest from Project and AnimationObjects from Hierachy, reloaded AnimationTest as described on page 225. All that works OK now, but I cannot get the cursor to change colour on mouse over. When I manually change the colour to green it doesn't show in the game view, but the white one does. How do I get the cursor to show in the game view when the run isn't playing - this should be possible according to the descriptions on p 203.
     
  32. yams_2

    yams_2

    Joined:
    Jul 29, 2013
    Posts:
    1
    Hi,

    I have the same problem although I use Transparent/Bumped Specular as Shader.
    Did you found a solution (other than use Mesh Renderer.Enabled which is less fun)?

    I'm afraid that you are right and that it's a bug (see http://forum.unity3d.com/threads/210947-Animating-material-parameters-in-4-3).

    Yann
     
  33. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129
    Hi Sue

    I've got it sorted! Having backtracked to the beginning of Chapter 6 and working forwards through scripts already programmed has its pitfalls but it's going OK for the time being.
     
  34. Empedokles

    Empedokles

    Joined:
    Dec 3, 2013
    Posts:
    2
    No sorry found no solution. But at least it is now confirmed that it is a bug. Thanks for the link!
     
  35. tetsii

    tetsii

    Joined:
    Nov 12, 2013
    Posts:
    5
    Hey all,

    The gameenvironment.prefab is broken for me. I tried importing it from every chapter that has it, but no luck. Unity absolutely freezes every time. I even tried opening one of the later scenes with no luck. The one time I actually got it open and running nicely, I noticed that the gameenvironment.prefab is not a prefab in the project window. It's just a blank document inside unity. I thought to myself, "okay, i'll just make a new prefab from the environment in chapter18 final". Nope, the whole thing locks up and I have to force quit unity. I am now installing unity on my windows pc to see if it's an osx thing, but yeah this is driving me nuts..

    Edit: gameenvironment.prefab doesn't work on windows either.
     
    Last edited: Dec 15, 2013
  36. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    hi tetsii,

    I just tried importing it into a clean project and it worked in 4.31 (other than not having a couple of the virtual inputs set up)

    So maybe try it in a new project see what happens- it is possible that file got corrupted on zipping

    let's hope it's not a mac/PC issue

    let us know if you track it down!

    thanks,
    Sue
     
  37. tetsii

    tetsii

    Joined:
    Nov 12, 2013
    Posts:
    5
    Hey, thanks for the reply!

    Yeah it doesn't work on a clean project either. I'm kind of running out of options here.. Is it anyway possible to get an upload of the file you are using? And are there any settings inside unity I should be aware of before importing? Something that could mess with certain types of imports.

    Edit: at least one of my class mates had the same problem and he didn't solve it, trying to find out more.
    Edit2: yeah happened to several others from my class. everyone had to skip the chapter 17 and everything related to the imported assets there.
     
    Last edited: Dec 15, 2013
  38. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    Hi tetsii,

    PM me give me an email address I'll give you a link to it (just uploaded it to DropBox)
     
  39. Twinny

    Twinny

    Joined:
    Apr 30, 2013
    Posts:
    13
    i was wondering if someone could help translate this into c# for me. i had no trouble with translations until this chunk in chapter 6 (page 204)

    function update(){

    //gets the current position as a Vector2 type variable
    var pos = Input.mousePosition;

    //feed its x and y positions back into the GUI Texture object's parameters
    guiTexture.pixelInset.x = pos.x;
    guiTexture.pixelInset.y = pos.y - 32; // offset to top
    }
     
  40. MightOverwhelm

    MightOverwhelm

    Joined:
    Nov 2, 2013
    Posts:
    8
    p.98-99
    I don't know how to make "SplatAlpha 0" could anyone lecture me how to do this?
     
  41. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    To make the splat map, you paint on the terrain- the different textures will be different colors on the splat map
    to see it, you must first save the scene where you painted the terrain, then you will be able to find it in the Project view under the New Terrain asset
     
  42. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
  43. MightOverwhelm

    MightOverwhelm

    Joined:
    Nov 2, 2013
    Posts:
    8
    Thanks for answer but after I paint the random terrain place and save but I don't still see splat map.

    Hope someone upload the video for it :(

    After I paint and save it just save never create anything on New Terrain Asset :(
     
  44. gary.gan

    gary.gan

    Joined:
    Nov 13, 2013
    Posts:
    12
    my approach is install v4.2.X. :D
    Since Unity is written in Mono, should be able to run multiple version, just like .NET counterpart

    http://unity3d.com/unity/download/archive
     
  45. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129
    Hi Sue

    More problems! I am using version 4,.3.1f1 and have successfully got as far as p288 in the latest version of your book. However, the Animation editor seems to be completely different from previous versions; I can no longer access anything except the position parameters - no Transform, no MeshRenderer, no BoxCollider, no Key(instance) etc. Of course, the position parameters were all I needed to make the key up animation, but I cannot now create the fade out. Any suggestions?
     
  46. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    hi Tony,

    you have to click the Add Curve button [and create an animation clip if there isn't one yet] to see all the old options

    but, animating material properties is apparently still broken, so fade won't work <sigh>
    you can make the curve, but it won't do anything
     
  47. gary.gan

    gary.gan

    Joined:
    Nov 13, 2013
    Posts:
    12
    Hi Sue:

    on page 686, I found this part is not working:

    but in the script given in 2GB+, it works:

    think it's sorta errata? or from old version's code?
     
  48. gary.gan

    gary.gan

    Joined:
    Nov 13, 2013
    Posts:
    12
    and also, in pg669:

    Code (csharp):
    1. internal var transportAtStart : boolean = false;
    but in pg 686:

    Code (csharp):
    1. 2. Check 'Transport at Start'.
    think it becomes a public variable(without internal), as in one of the script of 2G+ files, without any instruction.
     
  49. pat68

    pat68

    Joined:
    Dec 15, 2013
    Posts:
    34
    Hi everyone,

    where can I find the State Management PDF document described in chapter 9 ?
    I searched all the content within the ZIP package from Apress but didn't find anything (perhaps I am blind...;))

    Greetings
    Pat
     
  50. tholland

    tholland

    Joined:
    May 28, 2009
    Posts:
    129

    Thanks Sue. That explains everything! I'll carry on regardless!
    Presumably, Unity are aware of this bug and working might and main to correct it.