I started this thread for those of us who have picked up Will Goldstone’s Unity Game Development Essentials book. This is for observations, problems or discussions on the book.
I have emailed Will on this problem I ran into in Chapter 4 but I thought I would drop it out to the community to comment on or offers solutions.
In Chapter 4 your have the outpost model and are scripting to be able to open / close the door with character collision.
I built the script as written and had no errors in it. But when I take my character up to bump into the door nothing happens. I am using the first method, entering the extended boundary of the door.
Ive attached the script written just in case it is something in the script.
179319–6402–$playercollisions_444.js (742 Bytes)
I’ve only glanced at your source, but Mike asked if I could post:
Hope that helps,
I hit a very similar snag in chapt 4.
Did Will get back to you? Having a printed section with the final code would have been mighty helpful.
B.
You can download all unity packages from all chapters from the packtpub.com site if you login, but I could not find any scripts in them only models, textures, sounds, …
In the same location you can find errata but there were none at this time of writing.
In Chap. 5 there don’t seem to be the battery textures he refers to. Thinking that they may have been mixed into another package, I just imported all of them, but there is no texture folder in any of them. Did anyone else have this problem?
I have a question on Ch. 6 that I’m hoping one of you can answer. In the coconut script there is a line newCoconut.rigidbody.velocity = transform.
I thought the period at the end was a typo, but I guess it wasn’t. I’ve never seen a line with a period before. Does anyone know why it ends with a period instead of a semicolon?
Merries, Brendang - Arges is right you’re simply missing the starting capital O there. For the rest of you posting in here - the chapters are being redrafted as I right this… well obivously i’ve taken a quick break to reply, but otherwise i’m on it. I have several people, some from the Unity team and other trusted Unity experts picking me up on omissions and procedural issues throughout the chapters, so they will be fixed as soon as humanly possible.
Superherogeek - In Chapter 6 you’re misreading the book, there simply isn’t enough room on that line for the entire line of code - its all one thing - lines of code end as you point out with a semi-colon, I just check the ebook which I assume you’re referring to, you just need the rest of the line there.
Sorry for the inconvenience to you guys I promise i’m working as fast as I can to finalize these chapters - also working with the publisher to get the assets onto the site - they have all the assets so i’m not sure if / why the battery texture wouldn’t be available - please let me know if this is still an issue you’re having.
All the best
Will
Thanks Will,
The book, even in it’s RAW form, is a terrific learning tool and idea sparker. We’re simply getting a preview peek behind the curtain which is a rare thing. I’d much prefer a lil errata here and there than waiting till October for the polished version.
The one suggestion (plea actually), I’d make is, after a section of assembling code with the 'Now add this to the Bottom, and then add this" approach would be to have what the final script should look like at the end of that section. That way we can troubleshoot ourselves.
best,
B
This book is great! Haven’t gotten through very much yet, just wanted to follow this thread.
Can’t get the door to close completly on the outpost. I don’t think it is the script.
Maybe it come from something else, there is alot of manipulation of the outpost to do.
Same for me
same here with the door. Think I need a carpenter…
lol. For the battery I copy the book image and made .jpg out of it and import as new asset. I would post here but I am not sure Will would appreciate?
Anyone know where to download the sounds for the ambient music for Chapter 2? Was quite bummed when all I could download was the code off the site.
EDIT:
Nevermind.
Found it in another folder that wasnt chapter 2.
I purchased the RAW ebook a couple days ago and I’m finding it very valuable so far…however, I echo some of the sentiments mentioned earlier, most notably:
-
Not being able to find the battery textures for the GUI. Can’t really advance in the book until I get these…
-
For the outpost, my door doesn’t close all the way as well. This isn’t major but it’d be worth figuring out what the problem is.
-
typos typos typos! These aren’t major, though
Finally, I found some of the explanations a bit vague. Most notably when writing the script for the outpost’s door activation. I think this would be remedied with that section ending with a full printing of what the whole script should look like, and not just little parts of it.
Great book! Although the lack of battery PNGs are definitely annoying. They’re not part of the battery pack and I’ve imported all the files on the website.
Help anyone?
Ya some stuff is vague, and the FPC script description is not at right place in the book. Some explanations are clear as water. You can send email to him, hope he change it.
For the battery you can cut paste images from the book, it look horrible, but it dose the job.
Or just create 5 images
0 - 1 - 2 - 3 FULL
err… what page is the picture on? do you mean page 116? where it shows the project view and you can see the tiny thumbnail? That’s the only pic I can find :S
If so, how do you make the (white) background transparent? I’m using GIMP and/or microsoft paint…
Well yeah I noticed that too but just kinda made my own in PShop; I’m sure the assets package can be updated pretty quickly.
Yeah here is a problem since we are learning, this could do with fixing; it’s I am guessing in the animation? But see that I am guessing… so yes fix needed.
I agree that the final code (all of it) should be present at the end of each coding example… for a concise reference… given
Here is my final code for the player script in C# for those who are translating learning
using UnityEngine;
using System.Collections;
public class PlayerCollisions : MonoBehaviour
{
//Declare two public variables for sound clips visible in Unity Inspector to assist assigning door sounds for open / shut in editor
public AudioClip doorOpenSound;
public AudioClip doorCloseSound;
// Declare two variables; for a state check 'doorIsOpen' (true or false); and 'doorTimer'
//to be used to shut the door after an amount of value + Time.deltatime (to keep synced to frame rate) becomes more than 3 secs
float doorTimer = 0;
bool doorIsOpen = false;
// Use this for initialization
void Start()
{
// Nothing to do here yet
}
// Update is called once per frame
void Update()
{
// Using Raycast technique as to opposed collider checking 'OnColliderHit()' technique that is described in Chapter 4
RaycastHit hit;
if (Physics.Raycast(transform.position, transform.forward, out hit, 5))
{
if (hit.collider.gameObject.tag == "outpostDoor" doorIsOpen == false)
{
Door(doorOpenSound, true, "dooropen");
}
}
if (doorIsOpen)
{
doorTimer += Time.deltaTime;
if (doorTimer > 3)
{
Door(doorCloseSound, false, "doorshut");
doorTimer = 0;
}
}
}
/*original if statement calling the method 'shutDoor' for shutting the door after 3 secs,
* now we use new method 'Door' passing arguments to the method 'Door(AudioClip aClip, bool openCheck, string animName)'
* to be received as parameters for that method named 'Door'
*
if (doorTimer > 3)
{
shutDoor();
doorTimer = 0;
}
}
*/
/* TEMP COMMENTED OUT WHILST USING RAYCASTING METHOD IN Update() METHOD INSTEAD
void OnControllerColliderHit (ControllerColliderHit hit)
{
if (hit.gameObject.tag == "outpostDoor" doorIsOpen == false)
openDoor();
}
*/
/* TEMP INACTIVE AS WE REPLACE THE openDoor() METHOD WITH ONE THAT PASSES ARGUMENTS TO PARAMETERS IN THE METHOD 'Door'
void openDoor()
{
audio.PlayOneShot(doorOpenSound);
doorIsOpen = true;
GameObject myOutpost = GameObject.Find("outpost");
myOutpost.animation.Play("dooropen");
}
*/
// TEMP INACTIVE AS WE REPLACE THE shutDoor() METHOD WITH ONE THAT PASSES ARGUMENTS TO PARAMETERS IN THE METHOD 'Door'
/*void shutDoor()
{
audio.PlayOneShot(doorCloseSound);
doorIsOpen = false;
GameObject myOutpost = GameObject.Find("outpost");
myOutpost.animation.Play("doorshut");
}
*/
void Door(AudioClip aClip, bool openCheck, string animName)
{
audio.PlayOneShot(aClip);
doorIsOpen = openCheck;
GameObject myOutpost = GameObject.Find("outpost");
myOutpost.animation.Play(animName);
}
}