Jump to content

  • Log In with Google      Sign In   
  • Create Account

Gamedev.net will be down tonight at approximately 9pm EST for site maintenance


Member Since 04 Jun 2004
Offline Last Active Yesterday, 03:28 PM

Posts I've Made

In Topic: Databases: Why should I use prepared statements?

18 August 2015 - 03:28 PM

Because users can get creative in ways you might have not imagined; they might be able to circumvent your verifyUserInput method in a way that you did not expect. Use parameters in queries instead, which accept data for the types they really are irrespective of its content.



SELECT * FROM MyTable WHERE SomeField=@MyParameter

And then you define the type and value of @MyParameter -- the specific implementation details depend on the programming language, API and SQL language you're using.

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.\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.