• Unity3D - Discussion
    5,004 replies, posted
Sorry for a dumb question here but I'm not able to use var in Mono? When I try write for example, var wandLight, when I type var it doesn't appear and isn't recognized. Am I doing something dumb?
You mean monodevelop (the ide) ? It should really recognize the keyword. Maybe your compiler settings are set to .net 1.0 or something? I dont know when they added the 'var' to C# but I think it wasn't in there from the beginning, so I'd check that first.
[QUOTE=Over-Run;44200578]Sorry for a dumb question here but I'm not able to use var in Mono? When I try write for example, var wandLight, when I type var it doesn't appear and isn't recognized. Am I doing something dumb?[/QUOTE] [code] using UnityEngine; using System.Collections; public class MenuOption : MonoBehaviour { public var myName = "Collin"; // will not work void myFunc() { var myRealName = "It really is Collin."; // this will work } } [/code] I don't know why that's why it is, but I know that was something I figured out early on.
A little bit of progress today, add more of the backside coding so it'll be much easier to start implementing different types of unit blocks and have the foundation down for how they interact with each other. At the moment you can't add to the tower stack but I added in the ability to add Tenants. They have a chance of arriving every hour in multiple numbers and are grouped into four wealth types. The base unit apartment blocks are Low Income so only (Low Inc) tenants can be added. Click on the buildings to add them using my super awesome 30 seconds UI icons. Also adding in the messaging system and the system that determines how much income you recieve (as rent for now but when I add other blocks types does will be calculated as well) per hour, eventually might be per day. Adding tenants seems to be a bit buggy at the moment, sometimes you have to wait an hour before they'll move to an apartment, sometimes they just wont move at all. Speed up time to get more low income and see how it fares for you. I included a language test as well. [unity]https://dl.dropboxusercontent.com/u/10044881/Unity/TowerPrototype%200.2/TowerPrototype%200.2.unity3d[/unity] [editline]11th March 2014[/editline] Hmm, changing languages seems to be crashing the web player at the moment, not sure what's causing that.
[QUOTE=Proclivitas;44200993][code] using UnityEngine; using System.Collections; public class MenuOption : MonoBehaviour { public var myName = "Collin"; // will not work void myFunc() { var myRealName = "It really is Collin."; // this will work } } [/code] I don't know why that's why it is, but I know that was something I figured out early on.[/QUOTE] The first one shouldn't work in any case, the second should. What's your .NET version target set to?
I got it working anyway :) I'm trying to make a magic light spell for a wand. So I have the wand in the players hands, and I want to the light to shoot out from the direction the wand is facing. I'm using the Razer Hydras so I can move the hands in the 3D space so I'm not sure how to approach it.
Thanks for the help with the rotation, got it working now! I've run into a new problem I was wondering if someone would assist me with. I'm trying to instantiate a prefab, then set the value of a variable in a script attached to the prefab (it's a bullet, trying to set a direction for it). Currently I'm doing: [code] if (Input.GetKeyDown("space")){ GameObject b; b = (GameObject)Instantiate(shoot, transform.position, transform.rotation); var bscript = b.GetComponent("Bulletmove"); bscript.movedir = (hit.point - rigidbody.position).Normalize(); }[/code] But that's giving me a "Component does not contain a definition for movedir" error. "Bulletmove" is the name of the script, and movedir is a Vector3 defined at the start of Bulletmove. EDIT Got it working, needed a few (bulletmove)'s in there :smile: There we go, a nice start to my first unity game! [unity]https://dl.dropboxusercontent.com/u/124783721/WIP%20unity%20game.unity3d[/unity]
Are you using a physics-based controller? The player character is slipping while standing on slope.
I guess so, it's a rigidbody I'm moving about with code. It's probably better to do it entirely through code but I couldn't think of a decent way to do the slope walking - although now I know some more I might have a crack at it.
Create 2 physics materials, frictionless and max friction. Set the collider's physics material to frictionless while moving, max friction otherwise. Sample asset uses that too :v: Anybody using Unity 4.3.4f1 on Win 8.1? Is vertex snapping working?
[QUOTE=secundus;44212224]Anybody using Unity 4.3.4f1 on Win 8.1? Is vertex snapping working?[/QUOTE] On that version (Unity Pro 4.3.4f1) and 8.1 Pro, vertex snapping seems to be working fine for me.
Anyone made a FPS weapon system with Unity? Just doing some experiments. In Rust we use a custom shader.. but I'd like to avoid that if at all possible. So problems as I see them: [b]Weapon clips through world[/b] [b]Weapon casts crazy shadows in world[/b] [b]Weapon FOV can't be different to world FOV[/b] Seems like the ideal, cleanest solution would be to render the weapon in another camera.. but doing that means it won't receive shadows. It also seems like I can only render one deferred scene at a time. Trying to render another deferred, projected camera over the top makes the screen go black. Anyone else experience that? So as much as I hate the custom shader solution it seems like it's the only way?
Weapons clips through world, that is one of the biggest problem in CS:GO. What if you raytrace in front of player with weapons length every frame, then simulate colliding weapon with wall, so it wont actually collide and player will see it colliding (pushing against the wall etc), and adjusting crosshair accordingly?
[QUOTE=garry;44216544]Anyone made a FPS weapon system with Unity? Just doing some experiments. In Rust we use a custom shader.. but I'd like to avoid that if at all possible. So problems as I see them: [b]Weapon clips through world[/b] [b]Weapon casts crazy shadows in world[/b] [b]Weapon FOV can't be different to world FOV[/b] Seems like the ideal, cleanest solution would be to render the weapon in another camera.. but doing that means it won't receive shadows. It also seems like I can only render one deferred scene at a time. Trying to render another deferred, projected camera over the top makes the screen go black. Anyone else experience that? So as much as I hate the custom shader solution it seems like it's the only way?[/QUOTE] What if you were to use a second light source on the weapon's camera that mirrors the source in the game world and project the shadows as an alpha channel of the weapon's view camera? It's not perfect but it would be fast and give you psuedo world shadows. Just a crazy idea, probably won't work though.
[QUOTE=garry;44216544]Anyone made a FPS weapon system with Unity? Just doing some experiments. In Rust we use a custom shader.. but I'd like to avoid that if at all possible. So problems as I see them: [B]Weapon clips through world[/B] [B]Weapon casts crazy shadows in world[/B] [B]Weapon FOV can't be different to world FOV[/B] Seems like the ideal, cleanest solution would be to render the weapon in another camera.. but doing that means it won't receive shadows. It also seems like I can only render one deferred scene at a time. Trying to render another deferred, projected camera over the top makes the screen go black. Anyone else experience that? So as much as I hate the custom shader solution it seems like it's the only way?[/QUOTE] Not an expert but, 1) Check for incoming collisions and either push the weapon back or pull it up when you come close to objects. Else you can, like what you're actually doing, use a shader to ignore Z culling. 2) Make the actual weapon [URL="http://docs.unity3d.com/Documentation/ScriptReference/Renderer-castShadows.html"]viewmodel not cast any shadows[/URL] and cast the player's world model and weapon's model shadows instead. 3) Just pull the view model out/in and change its scale to make it look like its independant from the World FOV. Whatever, hope it makes sense. The best but most complicated way would require a rewrite and a lot of shiet to make it work with IK.
More on my dumb space game I posted awhile ago. You can drag and drop turrets from the build menu, they don't cost anything atm. [unity]https://dl.dropboxusercontent.com/u/67305390/0312/PlanetSmasher.unity3d[/unity]
Looking awesome dude. It does seem to freeze up the first time I click on a unit though
[QUOTE=Huabear;44218762]Looking awesome dude. It does seem to freeze up the first time I click on a unit though[/QUOTE] Thanks! I think I fixed that by removing the selection text which was old unity gui shit and not new daikon forge stuff
[QUOTE=stickmoos;44219207]Thanks! I think I fixed that by removing the selection text which was old unity gui shit and not new daikon forge stuff[/QUOTE] Yep, works perfect now. [t]http://i.imgur.com/rHhQHkF.png[/t] Come and get me
So I've figured out how to make Unity work nicely. Shit classes everywhere. Any group of remotely related variables, make it a class. Need to run a function often on different scripts? Class. Need to transmit multiple variables at once with broadcastmessage? Make a class? Need to run calculations on a number of variables? Another class! Want to run functions on static variables? Well then you can eat shit.
Is there a better way to make GUIs than manually typing and positioning every single box and button? It's so incredibly tedious.
Daikon Forge [url]https://www.assetstore.unity3d.com/#/content/10438[/url] Goes on special every now and then There's also some cheaper or free GUI programs but I still praise the holy light that is DFGUI [editline]13th March 2014[/editline] You could also try the free version of NGUI but I think the latest release was Sep 2013 for th free one. [url]http://www.tasharen.com/?page_id=140[/url] [editline]13th March 2014[/editline] Forgot to mention there is also apparently a new GUI system being built for Unity in a future release. Expected release date of 2089.
What software I could use if I am developing in Unity using JavaScript ? Right now I am using MonoDevelop but it's annoying because most of the time it cannot find my variables only very few of them. I don't really know what else I could use.
[QUOTE=BoowmanTech;44227031]What software I could use if I am developing in Unity using JavaScript ? Right now I am using MonoDevelop but it's annoying because most of the time it cannot find my variables only very few of them. I don't really know what else I could use.[/QUOTE] It's likely that's a problem with the language, as JS is dynamic it's very difficult (and sometimes impossible) to find all members for a given variable. At best you could make a very good heuristic for it, but as long as you don't evaluate the program there's no way to tell (if it supports eval. Otherwise you can do it by tracing all possible paths values and value members can take, but that might be not feasible/sensible for some reason).
How would I go about getting a list of folders in the Resources folder? I need to get a list of folders to populate the categories list for my part selection menu.
Maybe this? [url]http://msdn.microsoft.com/en-us/library/bb513869.aspx[/url]
[thumb]http://files.1337upload.net/fuckingshitfucks.png[/thumb] Can't get these fucking texture coordinates to work. [editline]14th March 2014[/editline] Texture importing itself works though.
Anyone knows a good tutorial that explains and shows how to animated a rigged character in Unity?
Can someone explain me why my GUI Text is postioned totaly wrong? Or am I just thinking dumb? O.o Scene (The marked one is the GUI Text, other one is the camera): [IMG]http://i.imgur.com/zAGlRLu.png[/IMG] Game: [IMG]http://i.imgur.com/TVIMhVU.png[/IMG]
[QUOTE=johnnyaka;44244507]Can someone explain me why my GUI Text is postioned totaly wrong? Or am I just thinking dumb? O.o *snip*[/QUOTE] Make sure that there aren't any other Anchors that are positioned strangely. Try setting the GUIText and all of it's parents to 0, 0, 0.
Sorry, you need to Log In to post a reply to this thread.