• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

GAF Learns - Unity [Game Engine]

It's working! \o/ (Yes it's nothing at all compared to what is coming I know but YAY anyway). Now I'll continue this tutorial about jumps, and then I'll make a better stage. Thanks guys!
 
Might seem like a bit of a bump (3 months, lol), but I just wanted to say I've been getting into Unity and am really digging it! If more people see this thread and how great it's resources are, I see that as a great thing. Unity is really straightforward. Can't wait to see what I can make with it.
 

Raging Spaniard

If they are Dutch, upright and breathing they are more racist than your favorite player
Question, I have been looking at tutorials, specifically for the particle editor and its all nice and good but I cant seem to find the option to add a texture to a particle effect anywhere.

Like, lets say i want a smoke effect to have pictures of my face coming out of it. This is something that should be achieved easily but I cant find an option to attach a texture anywhere. Any help?
 
Question, I have been looking at tutorials, specifically for the particle editor and its all nice and good but I cant seem to find the option to add a texture to a particle effect anywhere.

Like, lets say i want a smoke effect to have pictures of my face coming out of it. This is something that should be achieved easily but I cant find an option to attach a texture anywhere. Any help?

Drag the texture to the particle system in the inspector and that should do it. It might be picky about the spot, so drop it under everything else as a new component.
 
What timing! So happy I found this thread.

I'm in the IT world, but mostly as a support function. I've looked at a ton of logs and poked around a bit with some code - but I mostly play with scripts. I've been looking to get into a "language" but not something that is so open that I'll get lost trying to figure out what to do.

So I decided to try my hand at unity. Haven't started it yet. Just started looking at some tutorial articles/videos to figure out what I need. Is there a good list of what else I should learn? I've been looking into some sort of design/animation program like Blender or something like that.
 
new 4.6 beta is out.

new GUI tools look dope. tutorial is how to build a Mass Effect menu. ;)

Are you saying there is a tutorial, or requesting someone to make one? I'm pretty sure the former isn't the case.

Also, constructing a radial menu shouldn't be remotely difficult, you need to calculate the stick angle, and use that to figure out which segment it's pointing at. Not that difficult.
 

DedValve

Banned
This thread is pretty awesome.

I'm self-learning Unity and Javascript (never dealt with code before) and man is it tough. I think I'm finally starting to make sense of Javascript a little, at least in terms of how to read it.

I found this awesome tutorial that has you build a proof of concept space shooter and the guy goes into detail on the code specifically and why it works, this is really good since a lot of tutorials I find are in C# and not Javascript.

http://forum.unity3d.com/threads/unity-jump-start-video-tutorials.26785/

I'm still trying to figure out things like how to delete particle effects (since there is no more auto-destruct as demonstrated in that video) and with that my goal is to make this purple alien that follows the players (no real AI just an enemy that tries to kamikaze into the player).

I do have one question, is it possible to change the model of something? I made a cube, gave it a script and rigidbody, etc. and I know that I could just create a new model and attach the script and edit the settings but I think it would be faster if I could perhaps replace the cube with an actual model, or a model with another model really fast.

Also does anyone know of any good Javascript unity Tutorials? I'm scouring the web for some good stuff and will post my finds here. I'm still trying to come to turns with mindboggling stuff like GameObject and gameObject (I think I get it, GameObject is a specific Unity engine code while gameObject is referring to an asset you created).

Either way this thread is great. Any good console/handheld Unity games btw? (other than Angry Birds).
 

Lautaro

Member
I do have one question, is it possible to change the model of something? I made a cube, gave it a script and rigidbody, etc. and I know that I could just create a new model and attach the script and edit the settings but I think it would be faster if I could perhaps replace the cube with an actual model, or a model with another model really fast.

Do you mean during runtime?

If that's the case you can use this code: GetComponent<MeshFilter> ().mesh = newMesh;
 

Minamu

Member
Unity recently did a 2ish hour long tutorial on how to make a 2d game, does anyone know where I can rewatch it? I believe it was on twitch but I couldn't find it in the archive :/
 

sono

Gold Member
I need to learn C# for this to do professional games right? (I know c++ not sharp no training in sharp at all.)
 

Minamu

Member
I need to learn C# for this to do professional games right? (I know c++ not sharp no training in sharp at all.)
It supports C#, JavaScript and UnityScript I believe. If you know C++ you'll have very little trouble with C# imho. Just watch their scripting tutorials for their example games and you ought to be good to go.
 

BibiMaghoo

Member
Not sure if I should post here or the other thread, but I never get an answer there, so here I go.

I have been having major problems with resizing GUI for different resolutions. My game is built for 1080p, but I need to be able to allow lesser resolutions. I fired it up on a friends shitty work PC which has an older radeon card in it at a lower res, and it breaks the GUI positions, so I reworked it, rather than a specific position, using (Screen.width / 2 - 200, Screen.height/2 - 100) etc.

But this still leaves things broken, just not as much. How do you guys make sure the positioning is always the same regardless of resolution?
 

zeox

Member
I need to learn C# for this to do professional games right? (I know c++ not sharp no training in sharp at all.)
I came from a similar background of knowing pretty much only c++, and after learning c# I vastly prefer it. It's very easy to learn, especially if you already know c++

Not sure if I should post here or the other thread, but I never get an answer there, so here I go.

I have been having major problems with resizing GUI for different resolutions. My game is built for 1080p, but I need to be able to allow lesser resolutions. I fired it up on a friends shitty work PC which has an older radeon card in it at a lower res, and it breaks the GUI positions, so I reworked it, rather than a specific position, using (Screen.width / 2 - 200, Screen.height/2 - 100) etc.
This is a fairly old tutorial, but still does what it's supposed to do.http://www.41post.com/3816/programming/unity-scaling-the-gui-based-on-the-screen-resolution

Some of the syntax might have changed, but you'll get the idea by looking at the code
 

BibiMaghoo

Member
This is a fairly old tutorial, but still does what it's supposed to do.http://www.41post.com/3816/programming/unity-scaling-the-gui-based-on-the-screen-resolution

Some of the syntax might have changed, but you'll get the idea by looking at the code

Thanks for that. I've taken a look but as I use Javascript in Unity it's hard to discern some of the things used. I think I get what they are trying to do, I just need to rewrite it. It's a really awkward thing to have to fix, because there are so many GUI calls in my game, and each has already been positioned to a fixed spot at 1080. This is something Unity really need to build in, as it has such a huge bearing. I mean who makes a game and locks it at one resolution? No one ever did such a thing.
 

BibiMaghoo

Member
^You should check out the new UI system in the 4.6 beta. And maybe the video I posted a couple of replies back.

That looks awesome! I'm updating now, but I think I was more than one behind, and I am not currently a paying customer, so not sure if I can even use a beta update. When this has finished I'll see if there is another.

To be honest I didn't see the point in paying for it until my project is near completion, as many of the features locked out of free are not ones I would even use. Laughably, the thing that motivates me the most to buy it is just to get rid of the Unity splash screen on launch, as I see this as vital for any kind of release.

EDIT: Currently updating to 4.5.3f3

EDIT2 : Ok, I didn't realise the Beta was cut-off from the main updates, so downloading it now.
 
Really is fun to learn how to work with Unity. I have been out of the programming game for a long time but jumping back in quickly with Unity. Just love being able to learn and see your ideas come to life right away with just a quick click of the play button. Or not even have to run the program before seeing if you messed up in the code somewhere.

Been working with Unity for less then a week ( C# ) and got a scene going now where I got a lot of action on screen. Using Instantiate calls to create targets on the screen that I can shoot with my FPS style gun. Got lights moving all over the screen using triggers. Got Cubes and things rotating in the air. Little targets pop up every now and again here and there around the player to shoot at.

There are so many good tutorials and videos out there that it is very easy to get going. Love it.

Right now I am having to use manually added triggers for the events to continue on in the background using a background system timer and hope to figure out loops and such to be able to get this scene completely automated where I just run the program and the targets are Instantiated like every 2 seconds perhaps. The changing of the colors on my lights occur throughout the scene without my help and various things like that. Right now just using the system timer and If ( timer == 20000 ) type things to get stuff to happen.

Coming along though, and damn is it fun!

Trying to figure out the GUI Layer next and see if I can get a sort of RPG esque box at the bottom left of my screen in FPS mode that stays in the same area and has Health / Ammo and such like that. Will then work on getting that to update. If I can figure that out and the automation I should be able to throw together a simple game here in the next week or so.
 

DedValve

Banned
Anyone have Kinect V1 working on a mac with some reccommended apps to use?

I got it working on my mac but for some reason it's not playing nice with Unity and I can't figure out the problem. I used this process to install it on my mac (http://blog.nelga.com/setup-microsoft-kinect-on-mac-os-x-10-9-mavericks/) and it worked.

Then I downloaded Zigfu for Unity for mac (http://zigfu.com/en/zdk/unity3d/) and launched Unity with those assets. When I enter play mode the kinect camera works for a few seconds before just stopping (I can clearly see the red lights from the kinect camera just shut off but the green light remains on). After that Unity stops working and I have to force quit and restart before the process happens again.

Any help in getting it to work on Unity? I want to try and make a simple "game" where you grab things with your hands.

EDIT: As a side-note, is there some sort of Neogaf community github to see other peoples work and code?

I'm still on the fence if I want to completely focus on C# or JS...
 

Minamu

Member
Simple question I hope: Do I need Pro to be allowed to release a very basic 2D game on the Android google store?
 

Minamu

Member
No. Pro is only needed if you make around 100k a year.
Thanks for clarifying. A friend and I are trying to make an Android game in Java and Eclipse but recently Unity did a 2D tutorial essentially making the exact same basic game in three hours so I really want to switch platform and make it better xD
 

RiggyRob

Member
This thread's a bit ded, but I figured I should ask in this one before the Indie Game Development one.

Is there a script or prefab that allows you to 'snap' two objects when a collision is detected? My idea is to make an archery game, but as you can imagine controlling the two objects with your hands (I'm using the Leap Motion) is extremely fiddly, so being able to snap the objects together would be very useful.
 
This thread's a bit ded, but I figured I should ask in this one before the Indie Game Development one.

Is there a script or prefab that allows you to 'snap' two objects when a collision is detected? My idea is to make an archery game, but as you can imagine controlling the two objects with your hands (I'm using the Leap Motion) is extremely fiddly, so being able to snap the objects together would be very useful.

Hmm, do you mean just so that the two objects then move together? You can just make one object be a child of the other, with the "parent" property on the Transform.
 

Water

Member
Is there a script or prefab that allows you to 'snap' two objects when a collision is detected? My idea is to make an archery game, but as you can imagine controlling the two objects with your hands (I'm using the Leap Motion) is extremely fiddly, so being able to snap the objects together would be very useful.

Like HellBlazer said, making one the parent of the other will automatically move the child object whenever the parent object moves; the child object can still be moved freely. Dunno if that's what you are looking for - it might help if you described what objects in the game you need to tie together, and when.
 

RiggyRob

Member
Hmm, do you mean just so that the two objects then move together? You can just make one object be a child of the other, with the "parent" property on the Transform.

Like HellBlazer said, making one the parent of the other will automatically move the child object whenever the parent object moves; the child object can still be moved freely. Dunno if that's what you are looking for - it might help if you described what objects in the game you need to tie together, and when.

Thanks, I'll have to look into the parent property.

The idea is that I have two separate objects, a bow and an arrow - because I'm using the Leap Motion, it can be very fiddly trying to combine the two together (think Probably Archery but using your actual hands). A simple way to solve this is to make them snap together when they reach a certain distance of each other i.e. nock the arrow onto the bow.

The game has to start off with them both separate (since a harder difficulty mode will remove the snapping), but when the arrow reaches the midpoint of the bow object it should snap into place and from thereon it should move in tandem with the bow. I should also clarify that the arrow can't stay fixed to the bow forever, otherwise the game won't work obviously - if the child object can still move freely of the parent object, that would be very useful since I can make sure that when a force is applied to the arrow e.g. pulling it back, it doesn't take the bow with it.

I imagine the programmatic way of doing this is to check whether the colliders of the bow and arrow have hit each other, and if so, make the arrow the child of the bow, right?
 

Water

Member
The game has to start off with them both separate (since a harder difficulty mode will remove the snapping), but when the arrow reaches the midpoint of the bow object it should snap into place and from thereon it should move in tandem with the bow. I should also clarify that the arrow can't stay fixed to the bow forever, otherwise the game won't work obviously - if the child object can still move freely of the parent object, that would be very useful since I can make sure that when a force is applied to the arrow e.g. pulling it back, it doesn't take the bow with it.

I imagine the programmatic way of doing this is to check whether the colliders of the bow and arrow have hit each other, and if so, make the arrow the child of the bow, right?
Yeah, and then re-parent the arrow to world again (assign null as parent) when it flies off the bow.

I'm not sure that simple parenting solves your problem though. With a crossbow, an unfired bolt is rigidly attached to the bow, so parenting would deal with it perfectly. But you want "Robin Hood" style archery.

I suspect the actual goals you have for the snap are these, but correct me if I'm wrong:
1) one hand still freely controls the bow position
2) the other hand still freely controls the rear end of the arrow
3) the arrow shaft is locked to always go through a specific point near the bow
4) arrow can still freely slide and rotate as long as the contact is retained
5) the bow is automatically rotated to the direction of the arrow

I think that should be pretty simple too (at least basic prototype; you'll probably want to add some constraints and special handling for some corner cases). Just constantly move the arrow with the hand input, using the rear end as a pivot, and rotate the arrow towards the contact point on the bow. Then rotate the bow according to arrow direction. Takes a couple lines of code. If you have trouble with this, I can build you a little demo scene or something.
 

RiggyRob

Member
Yeah, and then re-parent the arrow to world again (assign null as parent) when it flies off the bow.

I'm not sure that simple parenting solves your problem though. With a crossbow, an unfired bolt is rigidly attached to the bow, so parenting would deal with it perfectly. But you want "Robin Hood" style archery.

I suspect the actual goals you have for the snap are these, but correct me if I'm wrong:
1) one hand still freely controls the bow position
2) the other hand still freely controls the rear end of the arrow
3) the arrow shaft is locked to always go through a specific point near the bow
4) arrow can still freely slide and rotate as long as the contact is retained
5) the bow is automatically rotated to the direction of the arrow

I think that should be pretty simple too (at least basic prototype; you'll probably want to add some constraints and special handling for some corner cases). Just constantly move the arrow with the hand input, using the rear end as a pivot, and rotate the arrow towards the contact point on the bow. Then rotate the bow according to arrow direction. Takes a couple lines of code. If you have trouble with this, I can build you a little demo scene or something.

Pretty much, this is what happens so far:

- The bow and arrow start off separately. The rotation of the bow and arrow is fixed so I don't have to worry about them turning around all the time (yet).

- The bow/arrow can be grabbed by the RigidHand and moved about. However, while grabbed, the bow cannot detect a collision with the arrow or vice versa.

- Pushing the bow and arrow together (instead of grabbing them) causes them to snap together (via OnCollisionEnter() - collision.transform.parent = transform;). This happens whenever a collision between the bow and arrow is detected rather than a collision at just the midpoint of the bow (for now).

- When the bow and arrow are snapped together (arrowConnected = true), the arrow follows the movement of the bow in the x and y axes (via Update() - arrow.transform.position = new Vector3(bow.transform.position.x -0.5f, bow.transform.position.y, arrow.transform.position.z);). Doing this means I can move the arrow forwards and backwards, but otherwise it'll follow the bow.

- When the arrow is moved back past a certain point (detectArrowPullback() - if pullbackOffset > threshold), the arrow should release from the bow and fly forward. I haven't got consistent results from this part yet, I'm still trying to figure some stuff out about it.

My main problem isn't getting the bow and arrow to snap together, it's the fact that the Leap Motion Grabbable/GrabHand scripts make the rigidbodies stop detecting collisions when they are grabbed. If I make it so that they do continue detecting collisions, the bow/arrow will constantly detect a collision between itself and the RigidHand, and jitter/shake violently. I posted about it in the Indie Game Development thread:

Hmm, sort of hit a block with my archery game.

I'm using the Grabbable/Grab Hand scripts that come with the Leap Motion SDK to grab a bow and arrow, and I'm trying to make it so that when you have a hold of both the bow and arrow (i.e. they're grabbed), they can collide and therefore snap together.

I can make it so that they collide and snap together when they're not grabbed, but the default implementation tells the rigidbody of the bow and arrow to stop detecting collisions when it is grabbed. Another option I have is to make sure that the rigidbody keeps detecting collisions when it is grabbed, but this makes the object jitter and shake violently since it keeps constantly detecting a collision between the bow/arrow and the RigidHand that is grabbing it.

Anyone know if there's a solution to this yet, or is it just a limitation of the Leap Motion controller?

Another thing is the hand grabbing the bow instead of the arrow when I'm trying to pull it back, but that might be because of the distances set in the GrabHand script being larger than the scale of the arrow.
 

Water

Member
My main problem isn't getting the bow and arrow to snap together, it's the fact that the Leap Motion Grabbable/GrabHand scripts make the rigidbodies stop detecting collisions when they are grabbed. If I make it so that they do continue detecting collisions, the bow/arrow will constantly detect a collision between itself and the RigidHand, and jitter/shake violently.

Have you progressed with the problem?

If the issue is weirdness with the Leap Motion scripts, I'd try decoupling them from the actual physics. You could have your Grabbable objects as invisible objects on a different physics layer so they don't mess anything up, and your real arrow/bow/whatever objects tracking the Grabbable objects' positions via a script. You should be able to develop and test the logic part without involving the Leap Motion at all if you just manually move the input objects in the editor.
 

RiggyRob

Member
Have you progressed with the problem?

If the issue is weirdness with the Leap Motion scripts, I'd try decoupling them from the actual physics. You could have your Grabbable objects as invisible objects on a different physics layer so they don't mess anything up, and your real arrow/bow/whatever objects tracking the Grabbable objects' positions via a script. You should be able to develop and test the logic part without involving the Leap Motion at all if you just manually move the input objects in the editor.

I have a little, but not as much as I'd like. A suggestion from the Indie Game Development thread was to use OnTriggerEnter rather than OnCollisionEnter, which could be alright for now but would need to be changed later. Having invisible objects do the physics and the arrow/bow textured object follow the invisible objects sounds like a good idea though.

I've been concentrating on what should happen once the arrow is connected to the bow rather than worrying about getting the arrow onto the bow in the first place - when the arrow is connected, pulled back by my left hand and reaches a certain threshold, it should disconnect from the bow and fly forward (Vector3.forward * 100 or something). What actually happens is that the arrow is still being grabbed by my left hand, so although it disconnects from the bow, it doesn't move forward (since it's following my left hand). I either have to figure out how to override the Grabbable script or somehow set the private _grabbed = true; variable in the Grabbable script to false.
 

gofreak

GAF's Bob Woodward
Since the thread's alive again, I'm wondering how many gaffers are using the Unity 5 beta? Any thoughts?

I've not dug too deeply yet, but so far I'm pretty impressed by the new options for plugging in custom rendering pipelines, or moreover, semi-custom ones, with CommandBuffers. I think Unity was already more flexible here than UE4, but this is another layer of polish/accessibility.
 

RiggyRob

Member
Since the thread's alive again, I'm wondering how many gaffers are using the Unity 5 beta? Any thoughts?

I've not dug too deeply yet, but so far I'm pretty impressed by the new options for plugging in custom rendering pipelines, or moreover, semi-custom ones, with CommandBuffers. I think Unity was already more flexible here than UE4, but this is another layer of polish/accessibility.

Not yet, I'm sticking with Unity 4 for now. What I'm really pleased with is that they've recently added Oculus Rift support for the free version of Unity, which is going to help my project a lot since there's no way I could afford the Pro license:

More awesome news today as Brendan Iribe, during his Oculus Connect conference keynote, announced that our two companies have extended our partnership in order to ensure that Unity is available for all of our development community. That means whether you’re using the free version of Unity or Unity Pro, you’ll be able to create awesome VR experiences for the Oculus Rift and the Oculus VR Store for free!

We’re working with Oculus to create an official add-on supporting the Oculus Rift in Unity that everyone will have access to for free. We know a lot of you have interest in creating new experiences and experimenting with one of the most exciting platforms around so we’re very happy to make that as easy as possible.

The Oculus add-on will include stereo imaging optimizations, 3D audio support, deeper Unity editor integration, inclusion of the Oculus Rift in the Unity development and debugging workflow, integration of Oculus-specific APIs within Unity, and direct publishing to the Oculus platform.

We do want to make sure everyone can work on Oculus projects while the Unity for Oculus add-on is in development. To that end, we’re working with Oculus to make the current Oculus plug-in, one that has been available for free for Unity Pro users, also available for those making games with the free version of Unity. This new plugin version will be made available for free download on the Oculus developer site as soon as possible.

We’re already seeing some amazing things being made in Unity for the Oculus Rift. Projects like Lucky’s Tale, Game of Thrones: The Wall, The Gallery: Six Elements, DarkNet, Titans of Space, Blocked In, and our 2014 Unity Awards winner for Best Student Project, The Rift: U.R.I.D.I.S., demonstrate the great creative potential in virtual reality and the Oculus Rift. We can’t wait to see what you can do with dedicated tools!

David
 

Water

Member
I have a little, but not as much as I'd like. A suggestion from the Indie Game Development thread was to use OnTriggerEnter rather than OnCollisionEnter, which could be alright for now but would need to be changed later. Having invisible objects do the physics and the arrow/bow textured object follow the invisible objects sounds like a good idea though.

I've been concentrating on what should happen once the arrow is connected to the bow rather than worrying about getting the arrow onto the bow in the first place - when the arrow is connected, pulled back by my left hand and reaches a certain threshold, it should disconnect from the bow and fly forward (Vector3.forward * 100 or something). What actually happens is that the arrow is still being grabbed by my left hand, so although it disconnects from the bow, it doesn't move forward (since it's following my left hand). I either have to figure out how to override the Grabbable script or somehow set the private _grabbed = true; variable in the Grabbable script to false.
Since I don't know how the Grabbable script works, I suggested a solution that doesn't rely on modifying it. If you have the Leap Motion stuff on one physics layer, and your regular physics (which the bow and arrow can still use) on another physics layer, the Grabbable object isn't connected to the arrow in the first place, or controlling the arrow - it's the other way around. The arrow has a script which makes it follow the Grabbable object until you fire the arrow. While firing the arrow you just have to turn off the script and there's no longer any attachment.
 

RiggyRob

Member
Since I don't know how the Grabbable script works, I suggested a solution that doesn't rely on modifying it. If you have the Leap Motion stuff on one physics layer, and your regular physics (which the bow and arrow can still use) on another physics layer, the Grabbable object isn't connected to the arrow in the first place, or controlling the arrow - it's the other way around. The arrow has a script which makes it follow the Grabbable object until you fire the arrow. While firing the arrow you just have to turn off the script and there's no longer any attachment.

Ah right - I haven't really experimented with different physics layers yet, but I'll be sure to do so.

I finally managed to get the university's Leap Motion VR Mount and the Oculus Rift at the same time, so right now I'm trying to test out the OculusUnityIntegration scene that came with the 0.4.3 Oculus SDK - previously I tried running the Tuscany demo in Unity with the Rift and just got the 'HMD and sensor not found' message, so hopefully the new SDK fixes that.

Edit: Yeeee baby, now we cookin'! Had to update Unity from 4.5.4 to 4.5.5 as well as the 0.4.3 SDK update, but now I can run the Tuscany demo through Unity with the display controlled by the Rift - you have to make sure the Rift Display Mode is set to Extend so that you can move the Game scene tab to the other monitor though, not entirely sure if you can do the same with Direct mode.

I assume the steps covered in http://vrmuseum.nl/unity/ work to actually make an executable of the game, since it seems to mirror most of the stuff in the OculusUnityIntegration and OculusBestPractices guides, so it should work the same way for making my archery game in VR. Either way, I'm pleased, feels like I've made some real progress.
 
Top Bottom