Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


btower

Member Since 04 Jun 2004
Offline Last Active Today, 05:51 PM

Posts I've Made

In Topic: Unity Code Help

18 May 2015 - 03:51 PM

In that case it seems like you forgot to actually fill in the BallPrefab variable using the Inspector window (You should assign a prefab to the variable). BallPrefab must be declared as a public field (not a property or a method) for it to actually appear in the Inspector window.

 

How to do this is also explained in the video I linked earlier.


In Topic: Unity Code Help

18 May 2015 - 03:39 PM

I think that's pretty close, but I would expect Instantiate to return a GameObject and not a transform.  Though it might work anyway.  You could always test by attaching a debugger to btower's code and seeing what the actual type of the thing is that is returned by Instantiate.  (It says Object in the API, but obviously your wanting to cast it to something more useful to you.)

 

I would say so too, but I saw a video of a Unity 5 primer this week where the programmer actually makes the same mistake, explains, fixes and tests it. See https://youtu.be/6eVfcEYxBPg?t=54m47s


In Topic: Unity Code Help

18 May 2015 - 03:22 PM

I'm not 100% sure if this is it (I haven't tested it), but if you're using Unity 5 then Instantiate will not return what you expect in your code. Instantiate will return an object of type Transform, from which you can use the GetComponent<Rigidbody>() method to get the actual Rigidbody you are looking for.

 

So instead of this:

Rigidbody rbBall;
rbBall = Instantiate(BallPrefab,trans.position,trans.rotation) as Rigidbody;
rbBall.AddForce(trans.forward * Speed);	

Use this:

Rigidbody rbBall;
var ballTransform = Instantiate(BallPrefab,trans.position,trans.rotation) as Transform;
rbBall = ballTransform.GetComponent<Rigidbody>();
rbBall.AddForce(trans.forward * Speed);	

In Topic: How can I get started with the Hieroglyph3 framework?

06 December 2014 - 09:34 AM

 

error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\directxtk.2.22.13.23\build\native\directxtk.targets.

 

Right click on the Solution (in the Solution Explorer inside Visual Studio) and select Enable NuGet Package Restore. Then try building the solution again. NuGet should then automatically download any missing package, if able.


In Topic: Storing Player Changes to Procedurally Generated Worlds

28 August 2013 - 08:56 AM

Minecraft stores modified chunks, in full, on the disk and loads them when the chunk is needed again. So in order words, once a part of the procedurally generated world is modified and this modification cannot be deduced from the procedural system itself, that part of the world needs to be saved and is no longer procedural.


PARTNERS