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

Beginning 3D Game Development with Unity

Discussion in 'Community Learning & Teaching' started by k3D-Junkie, Jun 20, 2011.

  1. Zoneman

    Zoneman

    Joined:
    Feb 6, 2010
    Posts:
    42
    @ Gene, I took a quick peek at your work. It looks good. I will go back to review your often. Thanks for posting.

    Okay.... Where's my update you all ask??? My hard drive crashed, I've been reinstalling, updating, configuring.... Well...! Also since I've been developing the book projects in tandem with an iOS version, and, keeping of the xCode Development environment running smoothly, it is also a big challenge for me. But I may halt that, since I do have the touches functionality worked out. I think I need to focus in the basic project, and return to iOS later ?.... Maybe. I could lose a whole day just trying to correctly configure my provisioning profiles. Lol!
     
    Last edited: Aug 19, 2011
  2. gposchman

    gposchman

    Joined:
    Jun 8, 2011
    Posts:
    31
    Hi All,

    I may not have mentioned it, but the light switches in the inner offices work now. Next I am working on text messages, an inventory screen, and inventory items. I haven't set up a distance from items to interact yet, I have the map of events for this level and I need to script it, I have two avatars to create to interact with and I need to work out how I want to handle dialog. Can't be more than a couple of hours worth of work. :eek: Once I have the texting done and the inventory system installed and working, I will post level again.
     
  3. k3D-Junkie

    k3D-Junkie

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

    Skip ahead to the last chapter where I discuss dialog trees. I can send you the file for the little sample if you'd like.

    Lawrence,
    Let us know what you decided on touches- I have an Android license, but have not even installed it yet. With all the tablets available these days, I may need to make some time to delve into it.

    Sue
     
  4. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    Hi there,
    I have a problem in Chapter 6 with the useMOCursorChange.
    I don't use the Material Change so I only use the Cursor Change.
    I write it in the GameManager and Interactor Script and every time I test, I get a
    NullReferenceException
    Interactor.Start () (at Assets/_DMO/Scenes/02_Find_Egg/Scripts/CursorScripts/Interactor.js:52)
    this is:
    useMOCursorChange = controlCenter.GetComponent(GameManager).useMOCursorChange;
    I took the original scripts and made copy and paste to avoid an error but I always get this error.

    What am I doing wrong? I am totally distressed :(
     
  5. gposchman

    gposchman

    Joined:
    Jun 8, 2011
    Posts:
    31
    Hi Alarna,

    I am not using it either, and I commented the lines out. Of course I am applying the code and information to my own game scene, I have a link to the scene in the thread that Zoneman set up. Take a look. I don't know if that will apply to your project or not.
     
    Last edited: Aug 23, 2011
  6. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    Thanks for your reply, but I noticed, that all lines with
    controlCenter.GetComponent(GameManager).....
    have the same problem.
    It always results in a NullReference.
    Every line with this gives the NullReference.
    Anybody an idea what may be the problem?

    PS: okay, fixed, there was a blank too much..... *sigh*
     
    Last edited: Aug 24, 2011
  7. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    Glad you solved the problem!

    For those of you new to scripting, a leading or trailing blank space or character can be one of the hardest things to spot when things don't work. Sometimes it helps to copy and paste instead of type.

    .
     
  8. tiya

    tiya

    Joined:
    Aug 25, 2011
    Posts:
    5
    The book is project based and takes you through the process of creating a classic first person adventure game- a genre that is very forgiving and well suited to beginning scripting. Even if adventure games aren't your final goal, you will be able to get a handle on the concepts and implementation of game logic, state management, inventory, saving/loading and other in-depth topics useful in many other types of games. The approach is to start small and add functionality a little bit time with plenty of visual feedback for your scripting efforts we will go to plan B where I will at least make sure the art assets are available.
     
  9. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    All of the art assets, project and scripts per chapter are available on the book's webpage on the Apress website. (no need for a plan B ;))
     
  10. caffeine

    caffeine

    Joined:
    Aug 31, 2011
    Posts:
    7
    Hi, I bought your book about a week ago and made it to Chapter 14 before having any major issues. Long story short, I had to resort to loading "BookProject Ch 14 Start"

    So, I've just started Ch 14 again and I'm trying to get the Drop Box to work. I get no errors but the items just go back to my inventory instead of, well, dropping in the box. I've gone ahead and set up the animated ChestInside (up to pg 662). I can get the message from the chest and the ChestInside pops back up.

    I get text that the crowbar has dropped into the box
    The ChestInside stays where it is
    I have Drop Type set to 1 on the crowbar and 2 on the ChestInside
     
    Last edited: Aug 31, 2011
  11. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    Wow- you're speedy!

    ok, your drop types look correct,
    The object that is responding to the pick is the ChestInside, so let's check the Lookup State 0 data for , let's say, the Message
    For the message (whatever element number it is at) it should have:
    Message Icon,1,Message Icon,0,Message,0

    This translates to:
    a-The ChestInside was picked by the Message Icon,
    b-The ChestInside goes into state 1 (its state 1 is Location 4- no longer in scene)
    c-The Message Icon goes to state 0
    d-The Message goes to state 0


    a- this seems to be working - you are getting the correct message for what you are picking it with
    b- this is not working- if you are still seeing the ChestInside as active in scene (its state 0) double check the
    c- not working - its state 0 should not put it back into inventory (that would be state 1)
    d- maybe not working - should go back to state 0 (which for it will be visible in scene)

    For the crowbar, Figure 14-2 is incorrect for that page! It won't get changed until pg 264
    after you get the drop box functionality working, since the crowbar pokes outside the box, I have you set it so it doesn't drop
    but in the image, the Reply State 0 should say" The crowbar doesn't quite fit in the wooden chest"

    so in figure 14-2, it should still look like:
    Crowbar Icon,1,Crowbar Icon,0,Crowbar,0

    This translates to:
    a-The ChestInside was picked by the Crowbar Icon,
    b-The ChestInside goes into state 1 (no longer in scene
    c-The Crowbar Icon goes to state 0
    d-The Crowbar goes to state 0 (in scene)

    so the crowbar sounds like it is behaving like it was told according to Fig 14-2

    not sure why the Message is not working

    can you make the changes to the crowbar data see if that fixes it?

    next thing to check if neither object is working-
    are the "dropped" objects getting relocated to the chest and just not enabled (visible)
    or are they enabled, but not in the correct location?

    let me know how it goes

    Sue
     
  12. caffeine

    caffeine

    Joined:
    Aug 31, 2011
    Posts:
    7
    Yeah, I'm going through the book once word for word, then I'll skim through again trying to implement my own assets. I needed an indoor project for these Texas summers. So far I'm really enjoying it.

    That did the trick, I was messing with the items that weren't doing what I want and assuming the ChestInside was correct. I guess I'm having a little trouble wrapping my head around arrays. I still don't have it all working, but I'm on the right track. Thanks for the quick reply!

    Eric Gibson
     
  13. Deleted User

    Deleted User

    Guest

    I just saw this book is available on the nook for $17.59, so I'm downloading it now. Looking forward to reading it!
     
  14. caffeine

    caffeine

    Joined:
    Aug 31, 2011
    Posts:
    7
    Edit: I think this is a typo: Page 712, 4. Drag the TerrainTriggerOn script onto it. Is this supposed to be the TerrainManager script?

    I'm getting 4 NullReferenceException errors from my 4 Terrain Triggers.

    Edit: Here's the real problem. The book says to put the CavernPosition script on the Cavern Group object, but the errors only go away when I put it directly on the Cavern object. But then the Steli Topi isn't going to drop with the cavern right?
     
    Last edited: Sep 4, 2011
  15. k3D-Junkie

    k3D-Junkie

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

    you are correct about the TerrainManager script- it goes on the TerrainTriggerOn TerrainTriggerOff objects

    I do have my CavernPosition script on the Cavern Group object and the TerrainManager script is looking for the Cavern Group in its Start function...but not in the book!

    ok, so page 711, in the Start function:

    cavern = GameObject.Find("Cavern Group");

    Good catch on that- I'll add it to the edits as soon as I can

    thanks!

    let me know if that gets it sorted out

    Sue
     
  16. caffeine

    caffeine

    Joined:
    Aug 31, 2011
    Posts:
    7
    I took some time yesterday just to tweak some things and get rid of old errors. It's all good now, thanks Sue. Back to the fun stuff!
     
  17. crocodile5

    crocodile5

    Joined:
    Sep 12, 2011
    Posts:
    18
    I am having some trouble at the inventory chapter.

    Opening the inventory panel with "I" key (or any assigned key) seems to work fine but the when I click the button for the inventory tab it generates NullReferenceException error at this line:

    I also tried adding these to the top

    And changing the OnMouseDown function to this:

    But it generates the same reply.

    Where am I doing wrong here? Thanks in advance.
     
    Last edited: Sep 12, 2011
  18. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    page number would be helpful...

    but, if you cut pasted your code, I see two spaces:
    in the first part, ("To ggleMode"); should be ("ToggleMode");

    in the third part,
    .S endMessage("ToggleMode"); should be .SendMessage("ToggleMode");
     
    Last edited: Sep 12, 2011
  19. crocodile5

    crocodile5

    Joined:
    Sep 12, 2011
    Posts:
    18
    It is on page 531

    Also the spaces happened when I copy pasted from the code so spaces are not in the code I checked it.

    Oh and I made my object name CameraInventory (without space) so I dont think that's a problem.
     
  20. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    It does sound like a renaming issue, so your renaming of the object itself and when you "Find" it should have worked- I would say use the original code from the book and check for exact names by copy paste, being especially care to look for a trailing space on the camera object's name in the Hierarchy view.

    Also, when you post your code that is not working, you need to copy paste it so it is exactly the same here so we can try to spot why it isn't working.
     
  21. crocodile5

    crocodile5

    Joined:
    Sep 12, 2011
    Posts:
    18
    Thanks I solved the issue :)

    Apperantly I put a space before the object name in the hierarchy view and now it's working.
     
  22. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
    Hi all,

    On page 116, it is supposed to execute the statement of simpleRotateToggle.js
    Unfortunately, nothing happened.
    Could anyone point out my problem?
    http://www.mediafire.com/?dca0z8jhy3p62lj

    Thanks in advance
     
  23. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    Hey there, new problem :)
    I d am in chapter 11, managing inventory. I don't use the assest of the book, I use my own assets. And if you do so, all positioning is another than in the book.
    I realized, that the inventory panel and arrows are setting up on an absolute space. x = 240, y = 200 for example. But then I have great problems, when I make a build and play on fullscreen or another resolution, because all positions aren't relative.
    I am no programmer and so it's difficult to change.
    I started positioning the inventory panel in the script with screen.width and height, so it will be on the same place in all resolutions and managed the arrows in the same way.
    My problem is now, that my inventory items are in the right place, if I have one side, but if I click on the arrows, the rows aren't in the right position.
    The positioning happens in the book with the gridoffset and amount, where we change from pixel to percent and there I am helpless.
    Is there any way or explanation to handle the inventory, if you use other assets with other sizes?
     
  24. k3D-Junkie

    k3D-Junkie

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

    it looks like you just need spaces around the +

    Code (csharp):
    1. print("State = " + rotateState);
     
  25. k3D-Junkie

    k3D-Junkie

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

    I think you have two problem.

    First, you should adjust the X and Y position of the entire Inventory Group on the screen in the Inspector - this is a percent
    At 0,0,0, everything is positioned at the center. Try moving it a little to the right by setting the X value to .2
    The only member of the group that will need adjusting is the Inventory Screen object

    The positions of all of the icons and inventory panel are calculated as offsets from the center of the group

    The next thing to solve is your icon offset sizes. You should be able to set the right amounts in the script and have the math do all the work for you.
    What size are your icons and offset?
     
  26. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    Hey 3D Junkie, thx for answer.

    My icons are 75px, my inventory panel 384, the offset is 15px.

    this is my code for the inventory panel:
    I want the inventory in the bottom right of the screen with a little space to the right and down.

    and for the arrows:

    Maybe this is very complicated and not correct but I am no prgrammer.

    But now I have problems with positioning the inventory icons relative and not absolute.

    In Game Manager script:
    In clickarrows script the shiftgrid
    That doesn't fit, if I click on arrow, the new first row is the middle row of the inventory panel.

    I hope you can understand what I've done and wrote, my english isn't the best.

    I need an elegant way for all screen resolutions and I can't see the forest for the trees... :(
     
  27. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    Maybe it's me :) I have a new problem.

    To gfet the cursor back on top of the menus, I should add a new GameManager script to the controlcenter. (Book 872). I did, copied the settings to the new script, deleted the old and the cursor isn't back on top.
    I didn't managed more backgrounds, I skipped this steps, is it possible, that's the problem?
    Which step is neccessary to get the cursor on top?
     
  28. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
    Hi 3D Junkie,

    Thanks. However, I did as above (adding space before and after + ) and it still does not work.
    From my knowledge, spacing should not have any effects on coding.

    Any idea? :(
     
  29. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    Are you sure with "rotation" state? In the first post you wrote "rotate" state.
     
  30. caffeine

    caffeine

    Joined:
    Aug 31, 2011
    Posts:
    7
    @rockysam If I remember correctly that's a very small script, just copy and past the whole thing here. I'm sure we can spot the problem.
    EDIT: If those are your scripts you linked on mediafire, your "onMouseDown" needs a capital O (it should turn orange if you are using the UNITRON editor)
     
    Last edited: Sep 22, 2011
  31. Zoneman

    Zoneman

    Joined:
    Feb 6, 2010
    Posts:
    42
    Hey guys, wud up? I haven't been around for a while. I had to break away from the Adventure Project because of the API update. Lol. But I'll be back soon. Even if I don't have any questions.
     
  32. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
    @Alarna: Sorry, I mistyped "rotationState" as "rotateState" in above post. Thanks.

    @Caffeine: You are correct. Thanks.
     
  33. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    It's okay now? Fine.

    I don't get the damned cursor above the GUI...... I deleted the GameManager script about 100 times from the Control Center and added it new, but the cursor is behind the GUI.

    Anyone an idea to solve this prob?
     
  34. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    Alarna,

    don't panic! one of the new features in 3.4 is a means to specify script execution order, so that may make the section on reordering the scripts obsolete (at least I hope so) and that could have changed the way they are ordered internally, which could break things

    I'll look into that and your inventory list idea first thing Saturday (my time zone ;))- sorry, been busy with paying work this week...

    Sue
     
  35. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    Hey Sue,

    thx for answer! I can wait, no problem. I have read about the script execution order and have tested it, but I am a bit helpless, because I don't understand, in which order I have to execute them.
    Maybe I should learn programming :)
    Except the cursor, my demo is done, yeah! Thx a lot for the book!
    I will link it in the other thread, as soon as I uploaded it.

    In the meantime, I am looking for a tutorial for a draggable inventory - this should be a very nice feature for players. In germany I would say: I tasted bllod, I think in english it's something liek took up the scent.
     
  36. k3D-Junkie

    k3D-Junkie

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

    A few questions for you-

    1- have you converted the pointer from the GUI Texture Object to the code-based pointer?
    This is important because UnityGUI will ALWAYS draw on top of GUI Texture and GUI Text objects (they show up in the Hierarchy) and it exists only as code in an OnGUI function

    2- if you said yes to #1, select the Control Center object
    In the Inspector, is the script order as follows?:
    MiscText
    MenuManager
    GameManager

    Draw Order- This is the order in which objects are drawn on screen.

    First, we give cameras a Depth number. The contents of the lowest number is drawn (or layered) first, the highest number is drawn last.
    If we are using GUI Texture or GUI Text objects in the scene, and they are all on the same camera layer, they are ordered using the Z transform. Lower numbers are drawn first, higher numbers are drawn last, or on top.
    Now, when we use UnityGUI, our text and images are controlled through scripting only inside OnGUI functions. THese will ALWAYS be drawn on top of all of the objects in the Hierarchy view.
    Inside the OnGUI function, controls are drawn in the order they are scripted- the code at the top of the function is executed/drawn first, the code at the bottom is drawn last. If we had put the code for the cursor in the same OnGUI function as the menu code, we would have put it at the bottom of the function.
    If you have an OnGUI function in more than one script, on the same object, the scripts are drawn in the order they appear in the Inspector, the top one being drawn first and the bottom one being drawn last. So, because we developed the GameManager script first and added the pointer to an OnGUI function, when we created a new script, the MenuManager, it was below the GameManager and the menus got drawn on top of the cursor.
    Before 3.4, this meant saving the top script as a prefab, deleting the original, then adding it back in so it was below the MenuManager script. This way the pointer code was executed after the menu code. The drawback, of course was that we had to re-enter all the data we set up in the original.
    The last scenario would be to have OnGUI functions in scripts on different objects. Since there is no way to predict the order the objects are evaluated, this was to be avoided at all costs before 3.4.

    With 3.4, we can now skip the part about making prefab, deleting original, re-entering data. While we can't drag and drop the scripts on an object to change their order in the Inspector, we can override the order they are evaluated/executed, with the new feature, Script Execution Order. To use this; Edit->Project Settings->Script Execution Order. Drag the GameManager and MenuManager scripts into it in the Inspector. Here's the confusing part- so far, almost everything we have scene evaluates from the top down. In the Script Execution Order, it is evaluated from the bottom up- as if you were seeing the layers on the table in front of you. The order should be:
    GameManager
    MenuManager
    So the MenuManager is executed first, and the GameManager is executed second, putting the cursor on top of the menus(ta-da!), If you get it wrong, just change the order by drag and drop within the Script Execution Order and hit Apply.

    I'm not sure there is anything in there that will solve the mystery, but maybe we can get a clearer picture as to where the problem lies.

    ----------
    Your idea to have drag and drop objects is all related to draw order, so I'll address it while I'm here. In the book I have you make a cube that lives on a separate camera/layer. I didn't work out the code to match a 3D object to the cursor's position, but it could be done. The problem comes with the UnityGUI ALWAYS drawing on top of scene objects. There is no way to have your 3D cursor on top of the scripted UnityGUI controls (text, buttons, etc).
    I can think of two solutions.

    The first is to not use UnityGUI and only use GUI Textures and GUI Text for your game's GUI. Since we started the project using those, you could experiment further to see how the text would work. It doesn't have nice features like word-wrap and it is not easy to control the color of the text. The up side is that you will have full control over which layer is drawn on top.

    The second option would be to reserve the lower part of the screen for text only and use UnityGUI for it. If you had a solid colored panel where the text was always displayed (must as the early graphical adventure games), you could change the cursor from the 3D object to the UnityGUI pointer. By tracking the cursor position, you could turn off the camera layer with the 3D cursor, and enable the code for the script version of the cursor.

    Anyway, hope this has been of help,
    Sue

    PS- re: tasted blood/ picked up the scent- nice analogy! A couple of years ago I wanted to get a Bavarian Mountain Hound (German = "Bayerischer Gebirgsschweißhund"). The only breeder in the US that I found would only sell his puppies to people who would use them to hunt game. But it turns out using dogs to track game in California is not legal. I wanted to train a tracking dog for competitions and search and rescue, - he wouldn't sell me a pup :( I decided to write this book instead :)
     
    Last edited: Sep 24, 2011
  37. Azel

    Azel

    Joined:
    Feb 11, 2011
    Posts:
    17
    I purchased the book when it came out (Beginning 3D Game Development with Unity) and downloaded the Apress 3.2GB files, but I never got around to reading the book or working my way through the project.

    That was back in June. As I understand, there has been a Unity upgrade which makes the book files (code or instructions) outdated, and perhaps some parts of the book. I still have my older copy of Unity and the Apress files.

    What should I do? Should I go with the older copy of Unity and Apress files? Or if I wanted to use the latest version of Unity (what is it 3.4?) What would I need to do or change?

    Thanks
    Azel
     
    Last edited: Sep 24, 2011
  38. Azel

    Azel

    Joined:
    Feb 11, 2011
    Posts:
    17
    I’m really looking forward to working through the books project (Beginning 3D Game Development with Unity) , but I am also somewhat dreading learning Javascript, since I have no coding background.

    Do you think this book is a good way to learn Javascript for a beginner or would you suggest I learn Javascript from another source and then return to this book project with some experience in coding?

    I’ve noticed many tutorials on Youtube and I noticed the forum Scripting section, I’ve even seen some payed courses on Unity that cover scripting. I’m just wondering which way is the best way for a beginner to learn Javascript. I could always complete the book project after I learned some javascript. It might make doing the project more enjoyable.

    It seems to me that coding in Javascript is tough to master and that it is a subject that deserves a book all on its own.

    Thanks
    Azel
     
    Last edited: Sep 24, 2011
  39. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    looking into offset inventory panel,

    changes in GameManager script for different icon and panel sizes:

    // Inventory layout
    internal var startPos = 90; // icon size 75 + offset of 15
    internal var iconSize = 75;

    Changes to object properties for those sizes:

    Inventory Panel, Pixel Inset
    -192
    -192
    394
    394

    ArrowLeft, Pixel Inset
    -135
    -165
    64
    64

    ArrowRight, Pixel Inset
    66
    -165
    64
    64

    Changes to offset the whole thing to lower left:

    Inventory Group, Position Transforms
    X 0.31 Y -0.24 Z 0.0


    Produces this result in 1024 x 768 screen resolution:

    $OffsetInventory.jpg

    Obviously the Inventory Screen object needs to have its Pixel Inset adjusted- I would increase the size or maybe even move it out of the group (don't forget to set its X and Y position to 0- it will have inherited the Inventory Group's transform when you take it out of that group)
    And the Inventory Panel isn't quite right- I would take a screen shot of the object layout and design the texture from that rather than trying to tweak the icon layout to fit the panel, though it will probably still need some Pixel Inset adjustment.

    Note that I have clicked the arrow to get to the 4th column of items and everything is still behaving correctly :cool:.

    At this point, I can change the Inventory Group's X and Y position and everything moves intact and functions correctly. If I wanted, I could animate the Inventory Group sliding out from the right side of the screen by animating its X position when the cursor moved off to that side. (and yes, I was tempted to add that, but the publishers wanted me to finish the book...)

    For different resolutions, rather than stressing about an equation to calculate the correct X and Y offset, I would get the scree,width and screen.height, then assign the appropriate values. You probably won't allow more than about 3 screen resolutions so it is easier to figure out the best values for each.

    Hope this helps!

    Sue
     
  40. Zoneman

    Zoneman

    Joined:
    Feb 6, 2010
    Posts:
    42
    @ Azel
    Yeah! Sue has addressed this and posted the changes/corrections/updates to the book in earlier post. After you update everything. you should be good.

    But If you need an opinion...You may just want to consider a few things. It may be easier to stay with Older version of Unity and the book as is. But after you complete the book project, you will need to re-learn the new API item(s). I think it's only one item, but it affects several places in the book project.

    Nevertheless, I get the impression that "real" programmers deal with this "API" depreciation stuff all the time. And they make the adjustments as they go. Expect change, and adapt swiftly. I'm planning to update everything. It may require more effort, but it's the best use of time.
     
  41. k3D-Junkie

    k3D-Junkie

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

    I wrote the book assuming the reader is more of an artist or designer and has never written code of any kind before. If you are seriously wanting to become a programmer, then you might want a more formal introduction to scripting. If not, you should be fine with this book as I approach the scripting as a child would learn a new language. We start out with small scripts, experiment with making small changes and add stuff a little at a time to make them more interesting. I rarely go into great depth about the code itself as most can be used without understanding the math behind it, but I do offer links to explore some topics more fully.

    Maybe the others on this forum can give you their opinions about this.

    If you do decide to learn more JavaScript, be aware that most of what you will be using in Unity is specifically for realtime 3d use and a lot of that specific to Unity itself.

    As for version changes (author's nightmare) the biggest change is the scripting variable type, 'private'. The easiest way to fix all the files that come with the download is to do a search and replace, substituting 'internal' for 'private'.

    I'm updating the errata (list of changes) to the book this weekend to include the 3.4 changes as well as some typos found by Caffeine a few others.

    BTW- congratulations go out to Caffeine - he gets the 'First to Finish' award ;)

    Sue
     
  42. k3D-Junkie

    k3D-Junkie

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

    Thought I'd break out this bit from a previous post as it is a super time saver!

    Chapter 16, ~ page 872

    With 3.4, you can now skip the part about adding a new GameManager script to the Control Center object, re-entering the data and deleting the original. We can now override the order in which they are evaluated/executed with the new feature, Script Execution Order.

    To use this;
    1- Edit->Project Settings->Script Execution Order.
    2- Drag the GameManager and MenuManager scripts into it in the Inspector.

    Here's the confusing part- so far, almost everything we have seen evaluates from the top down. In the Script Execution Order, it is evaluated from the bottom up- as if you were seeing the layers on the table in front of you. The order should be:
    GameManager
    MenuManager

    So the MenuManager is executed first, and the GameManager is executed second, putting the cursor on top of the menus (ta-da!), If you get it wrong, just change the order by drag and dropping within the Script Execution Order and hitting Apply.

    $ScriptExecutionOrder.jpg

    I love changes that mean less typing!
     
  43. Azel

    Azel

    Joined:
    Feb 11, 2011
    Posts:
    17
    Thank you for the quick reply Sue.

    No, I don't want to become a javascript coder. I just want to understand Javascript enough to trouble-shoot problems as they come up in the project. I will use your book to learn Javascript as you suggested.

    Do I need to download Apress book files again? Have changes been added that I need?

    [I'm updating the errata (list of changes) to the book this weekend to include the 3.4 changes as well as some typos found by Caffeine a few others.]

    Where is this errata located? Is it part of the Apress book files?



    Thank you
    Azel
     
    Last edited: Sep 25, 2011
  44. k3D-Junkie

    k3D-Junkie

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

    No, you don't need to download the Apress files again- I haven't changed those. The errata file, PostPublishEdits.doc is somewhere in this thread, I think I will move it to the first post after I update it tomorrow.

    I think you will find a good portion of the book is about design decisions and problem solving. And of course you can get help here on the forum if you run into problems.


    Sue
     
  45. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    Hi Sue,

    1. yes, I converted the pointer (512 and following)
    2. The order on the Control Center is
    Misc Text
    MenuManager
    GameManager

    Using the script execution doesn't show any effect. I tried both - Gamemanager on top and MenuManager on top.

    I have no idea what I can do now.

    I have checked all settings of textures, cameras and so on and I cannot find an error. But the cursor stays behind the Menu..... I hate him. Really.
    Any ideas?
     
  46. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    well, I'm baffled and I don't like mysteries...

    can you pm me a link to the zipped project?

    also, Mac or PC? what OS are you using?
     
  47. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    Uff :)
    Okay, I will test to export the scene and send you the link.

    PC - Windows 7 Professional, project is for web player.

    edit: It will take a while, 81MB....and only 6k DSL.
     
    Last edited: Sep 26, 2011
  48. k3D-Junkie

    k3D-Junkie

    Joined:
    Jun 14, 2011
    Posts:
    236
    Got it!

    OK, looks like the problem is your menus- you are using GUI.Window and that draws on top of everything else in your game window.
    From the docs: "Windows float above normal GUI controls"

    If you revert to using the regular OS cursor, ( Screen.showCursor = true in the Start function of the GameManager script), you will see that it will draw on top of the GUI.Window.

    So, I guess you have two options, you could turn off and on the regular screen cursor when you turn on a GUI.Window, or you could convert your GUI.Windows to GUI.Boxes

    maybe three- you could post a question on Answers to see if there is a way to get the GUI.DrawTexture to be drawn on top of the Window control

    anyway, mystery solved!

    Sue

    (nice menu artwork, btw :) )
     
  49. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    Hey Sue, args...that aren't good news. i don't know how to convert in GUI.Boxes, so I will think about the regular screen cursor.
    In this context, the behaviour of Unity isn't pleasable. It should be possible to put a custom cursor on top of the GUI. Perhaps I should make a suggestion :)

    Thanks a lot for your help! As you could see, I didn't copy your scripts and made some things on my own, so this was the problem you couldn't find out where the problem was. Sorry :)

    Hope to read more tutorials from you, I am no english native but I could understand all of your explanations! That's something I cannot say to the most english tutorials.
     
  50. Azel

    Azel

    Joined:
    Feb 11, 2011
    Posts:
    17
    What software was used to make the models, and to import models and animations into Unity in the lessons? In reading other posts I've discovered that Unity has problems importing models and animations from some modeling programs.