benArcen

Unity Questions Thread

Recommended Posts

Yeah, it works when the parent is scaled uniformly. I tried using lossyScale and it didn't seem to make a difference. The beam is always rotating of its own accord as it is meant to do vertical or horizontal sweeping motions, so maybe that just makes it impossible to get an accurate reading. My current solution to the problem is to just not scale any of the parents that use the beam non uniformly, but of course a better solution would be nice.

Share this post


Link to post
Share on other sites

Ok so it seems the Box Collider (and various other colliders) won't work correctly in your scenario, see http://docs.unity3d.com/430/Documentation/Manual/Transforms.html the "Performance Issues and Limitations with Non-Uniform Scaling" section. Non-uniform scaling is quite ugly in general and it seems Unity chose to not handle tricky situations it causes.

 

I think that in your case even your beam mesh has to deform at least a little during doing the swiping motion (well provided you use a mesh for it).

 

I believe this can be solved by detaching the beam from its parent object. Create the beam as a top-level game object and set its transform in a script (you can use some dummy attachment object as a child of the original parent and read its world position and rotation, of course you'll have to modify the rotation for the beam to do the sweeping motion).

Share this post


Link to post
Share on other sites

The beam's position and rotation was already handled by script, so de-parenting it was no trouble at all, and it solved the problem. Thanks!

Share this post


Link to post
Share on other sites

Non-technical question:

 

What is experience like actually publishing a unity game? What platforms have people published their game on (Steam, iOS, Android, etc). 

 

How is publishing for mobile? I'm trying to get a game out to mobile via gamemaker and they seem to have really poor support for multiple devices. Does unity address this and other mobile related issues well? 

Share this post


Link to post
Share on other sites

iOS is a little weird to develop for, you output to an xcode project and then compile that. Nothing too complicated though.

 

For Android, Unity spits out APKs like it's nothing. Super easy.

 

Also you can use the #if UNITY_ANDROID and the #if UNITY_ IOS precompiler commands to help out with platform specific stuff.

Share this post


Link to post
Share on other sites

iOS is a little weird to develop for, you output to an xcode project and then compile that. Nothing too complicated though.

 

This is also how Win8/phone is done, you export a .sln from Unity, open it in Visual Studio, and compile it on a Windows 8 PC. I haven't actually submitted a game so I don't know how it goes from there but that part was...mostly straight forward.

Share this post


Link to post
Share on other sites

Also you can use the #if UNITY_ANDROID and the #if UNITY_ IOS precompiler commands to help out with platform specific stuff.

 

SpennyDubz's suggestion is probably the best for platform dependent code, but you can also use the RuntimePlatform enumeration to accomplish this if you prefer.  This is particularly useful if you need to do some OS specific editor code.

Share this post


Link to post
Share on other sites

What do you guys use for UI? Specifically text I need a better solution for.

 

The Unity 4.6 Beta! :tup:

Share this post


Link to post
Share on other sites

Does anyone here have any experience importing animations from Blender?

Trying to make a swinging door, and have made two animation actions (one for each extreme point of the door), but these don't appear in Unity after importing.

It seems to me that they don't count as animation actions if there's no change between the keyframes in Blender maybe?

Share this post


Link to post
Share on other sites

Does anyone here have any experience importing animations from Blender?

Trying to make a swinging door, and have made two animation actions (one for each extreme point of the door), but these don't appear in Unity after importing.

It seems to me that they don't count as animation actions if there's no change between the keyframes in Blender maybe?

 

For skeletal animations the first thing I always check is to make sure that the Animation Type in Rig Options is set to Legacy. (Not sure if that would be the case with the swinging door too, but I think so).

Share this post


Link to post
Share on other sites

 

The Unity 4.6 Beta! :tup:

 

How is the new UI system overall?  I've seen some overview of the features but haven't spent much time with it myself.

Share this post


Link to post
Share on other sites

How is the new UI system overall?  I've seen some overview of the features but haven't spent much time with it myself.

 

I like it. With the old system, I would clumsily go between scripting OnGUI() commands where I was forever adjusting public variables for the rect and using 3d text when I got sick of it. The new system feels much more easy to use for me. I actually can see myself using it just because I find pleasure in doing so. I pick a GUI element from a dropdown, drag it into place, put a command on it PlayMaker style and I'm good.

Share this post


Link to post
Share on other sites

I really really like it. I've only done some very simple stuff so far, but it's all really intuitive and layout-ing the UI is super easy! I haven't dug into event stuff because I haven't started on menu stuff yet.. But the tutorials on it make it look dead simple.

Share this post


Link to post
Share on other sites

Referring to the event-system for the new UI-system in 4.6:

Basically, you attach an object to the button in the inspector, choose one of its components from a drop-down, then select a method from that component's script with an optional value to pass into it.

Share this post


Link to post
Share on other sites

So GameObjects in Unity can be expensive(as your demo shows), and this is because GameObjects are kind of meant to be for complicated things that are going to be scripted somehow, interacted with by the player, or interact with the environment. For your demo here you should build a particle emitter that spits out meshes. Particle systems are used with sprites a lot, but there's nothing stopping you from spitting out your cubes too.

http://docs.unity3d.com/Manual/ParticleSystems.html

 

You could also combine the meshes of all your cubes together into a single game object as in the following question on the Unity site:

http://answers.unity3d.com/questions/10165/combine-objects-instantiated-at-runtime.html

 

Basically, in order to optimize, you need to find a way to cut down on the memory footprint of each individual cube being constructed. GameObjects are handy, but there's a lot of overhead because there are a lot of things going on behind the scenes to make them so handy. This is also why there's an overall global limit to how many you can have in a scene. Right now there's a lot of cool possibilities because all those cubes are individual game objects, but your demo isn't really using any of those features. So optimization is about making the decision about what you want those things to do and making things more efficient by doing away with the possibilities you don't need.

 

I finally got around to implementing this after casually watching a few tutorials on particle-systems in the past month.  It worked really well. I haven't do anything regarding combining meshes, but once I did use a particle-emitter. I put a particle-emitter on the paint-brush, turned the particles into cube meshes, and changed the shader to the mobile/vertexLit shader. I just ran the game for 5 minutes and I was still getting 64fps. I'll put a build up when I make one. I want to fix some more stuff first.

Share this post


Link to post
Share on other sites

Has anyone tried to make (or found) a semi-reflective and/or translucent glass material/shader that works without Pro? I poked around a little bit today without much luck, the most promising thing I found was Hard Surface Free on the asset store, but it apparently broke in 4.5 and most of the other shaders I've found are from years ago and don't seem to work either.

Share this post


Link to post
Share on other sites

I haven't tried anything with reflections yet but translucent materials are pretty easy to achieve out-of-the-box as evidenced by this fat glass fisherman.

(maybe Specular instead of Diffuse would look glassier still)

 

BQ7PM.jpg

Share this post


Link to post
Share on other sites

There are a few options on the UnifyCommunity wiki, including a few that are meant to fake the effects you can only get in the pro version.  If you can spare the money I'd recommend getting the subscription to Unity for $75 (US) per month which I recently had to do for work.  It's nice to always be able to use the most up to date version of Unity, however you should note that any money paid toward the subscription can't later be applied to the purchase of a full license, and the agreement lasts a minimum of one year.

Share this post


Link to post
Share on other sites

How complex would writing a program that takes Unity screenshots and turns them into .gif files be? Where would I start? I already got screenshot functionality set up.

 

Update:

So there is some open source software with the Apache license (which I believe means that I can redistribute it with my game) called imagemagick that can convert .png files into animate gif files. Now I guess I need to figure out how to write a program that Unity opens that automatically takes all .png from a folder and puts them through imagemagick?

 

Update: This is looking promising.
http://www.dotnetperls.com/process

Share this post


Link to post
Share on other sites

So I'm trying to make a procedurally generated 2D terrain. I was messing about with instantiate at first, and it does a good job of making the surface that the player should be colliding with, but I also want graphics that'll fill in all the space beneath those surface objects. Obviously game objects are overly resource heavy, especially because I was making the surface by doing a series of tiny cubes, and I'd end up with thousands of cubes if I made all the terrain out of them.

 

So since instantiate is strictly a game object function, does anyone have a suggestion of a different tact to generating the graphics? I'm not sure if it'd be easier to make a procedural 2D mesh or just modify the original idea to make a series of 2D sprites or something. I'm assuming the series of things would be more resource heavy, but how bad they'd be I don't know. Any thoughts?

 

 

Also, minor gripe about much less important thing. Unity seems to not support regular Arrays? I don't understand how that works, but apparently if I have an array full of numbers I can't evaluate them mathematically because it automatically just thinks an array is full of objects. Am I doing it wrong or is unity just kinda weird here?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now