C# Int to Float conversion performance
What is the performance of int to float casts in C#. I'm looking at the lightning example from Unity Procedural Examples, and there are two int -> float casts inside the tight loop. My understanding...
View ArticleGame architecture best practices
Is there any best practices guides, or just advice regarding the best approach to game architecture for Unity? In particular Unity's component system seems to allow a completely different approach than...
View ArticlePlanet shader not working: _ObjectSpaceCameraPos which was removed
I am trying to use the 'Planet' shader from the Unify wiki. http://www.unifycommunity.com/wiki/index.php?title=PlanetI get an error when importing this shader in Unity 3.1:Upgrade NOTE: SubShader...
View Articlehow to do in-game drag and drop GUI
I want to make a GUI which allows for drag-drop behavior.I have started out using GUILayout.box() and planned to use the 'Input' functions to detect mouse input, but I could not find a way to get the...
View ArticleFind Texture by path in script
I have a texture in the 'project' tab, I want to 'find' it in script:Texture tex = ??Is there a way to do this similar to Shader.Find or do I have to attach it to a GameObject and do via the GameObject?
View ArticleComponents using Generics
I have a class using generics:ProjectileWeapon.cs:public class ProjectileWeapon<T> : WeaponBase where T : ProjectileEffectWhen I try to drag the script in the Editor I get an error saying the...
View ArticleOnMouseExit fires every frame when the mouse is down?
I have a model with a rigidbody attached and I change the material in OnMouseEnter and OnMouseExit. It works correctly when I don't hold the mouse button down, but when I do have any mouse button held...
View Articlepublic fixed size array in inspector
Is there a way to create a public fixed size array visible in the inspector? I want to do something like the Particle Animator's 'Color Animation' variable where it appears like this in the...
View ArticleHow to create ParticleEmitter in code
When I try to add a particle emitter in code like this:ParticleEmitter emitter = gameObject.AddComponent<ParticleEmitter>();I get this error:Cannot add component of type 'ParticleEmitter' because...
View ArticleHow to initialize ParticleEmitter created in code
I have created a particle emitter in code and I cannot initialize it:ParticleEmitter emitter = (ParticleEmitter)gameObject.AddComponent("EllipsoidParticleEmitter"); emitter.minSize = 0.5f;I get an...
View ArticleHow to make many small blinking lights
I am using Unity free version and targeting web player. I want to put lots of small flashing lights in my scene, probably in the order of 50 - 100.Should I use point lights and deferred rendering or is...
View ArticleCamera on top of GUI
I am using extra cameras in my GUI to inspect items. I would like for the camera to be drawn on top of the OnGUI stuff but instead the GUI is drawn on top. I'm using OnGUI to draw the GUI, is there a...
View ArticleSet first scene
Hi this must be really simple but I can't find it. I have created my game and now I'm adding a main menu start screen but when I build it always starts on the game screen.How do I set which scene the...
View ArticleBest practices for smart phone development
I have seen people mention that minimizing draw calls is important. I'd like to know what other things are important and also what shortcuts/libraries are available to get the most out of the devices....
View ArticleLOD system with Partial object culling?
I want to make a planet which is quite detailed. The player will never 'land' on the planet but they can get close enough that it takes up the whole screen and far enough away that it would look as...
View ArticleHow to activate Android trial
I downloaded the latest version of Unity and it said:> Free Full Version for Windows with> Unity Pro and Android trials. http://unity3d.com/unity/download/ I want to get into android development,...
View ArticleUnity hangs when attempting to build for Android
When I start Unity I get the following warning:> Set-up Android SDK path to make> Android remote work When I build for Android I get a popup prompting me to locate the Android SDK. I selected:...
View ArticleUnity Color scheme broken
When I started my Pro trial the colors in Unity all changed and now it's really hard to read. http://img850.imageshack.us/i/unityscreenshotbrokenco.png/
View ArticleAndroid skybox not visible in emulator
I cannot get my skybox to show up on the Android emulator. I have a simple scene containing: one camera, one skybox, one cube, and one directional light. I can see the cube, but the skybox is not...
View ArticleDoes Unity support SIMD instructions in mono?
I haven't found anything about this except this forum post and the post it links to: http://forum.unity3d.com/threads/86932-Possible-to-use-Mono.SIMD-with-unity I tried the following to no avail, so...
View ArticleFire effect with minimal overdraw
I am porting my space game to Android and the engines had fire coming out the back. This effect was cheived using a particle emitter pointing at the camera, this causes a lot of over draw. My...
View Articlestreaking lines for warp speed
How would I make the streaking effect for moving to warp speed? I think Ideally it would use motion blur but I'm using Unity basic and I'm developing for mobile so that is out of the question for me. I...
View ArticleLighting for a planet on mobile
I am making a space game for mobile and I want to make a planet. I have tried using the Planet shader from the wiki but it doesn't seem to work. I am currently just using a diffuse shader. I want to...
View ArticleCreating a Mesh asset inside the editor
I am trying to save a generated Mesh from an imported .obj file. I basically take a sphere which I have created and UV mapped in blender and then modify it. This works fine, I get exactly the result I...
View Article