Change the easy script for better performance
Hi, I have 200+ objects and I call this script in update function. This decreases my performance a lot. Is there a way how to write it better? I am in 2D. void rotateObject(Vector3 rotationTarget, int...
View Article2D Spaceship like movement without Rigidbody2D
How would you go about making 2D top down spaceship movement WITHOUT rigidbody2D? You may ask, why not to use it? Well my answer is, because when I have a lot of objects with rigidbody2D (200+), the...
View ArticleMax size of scene map
Hi there, I have 2D galaxy generated with 50+ systems. But some systems reach even 100 000 units in coordinates. (So 100 000 Unity units (in Transform) from middle(0,0,0)). Is it good? Or should I...
View ArticleProfiler Overhead 90%. What?
What is Overhead? How comes it takes entire 90% (5ms) from the profiler? Is there way how to reduce this horrible number? Will gladly give additional information if needed. I am targeting for PC so no...
View ArticleParenting - performance Question
Is it good for performance to have under one objects parented other 100 objects and under them other 1000 objects? So one parent can have 10000+ objects in it. Will it have impact on performance?
View ArticleTwo dimensional HashSet/List
I need to have 20 groups in my game. Let's say each group can contain up to 10 gameObjets. But ofc I don't want to do: HashSet group01 = new HashSet(); (HashSet is the same as List) HashSet group02 =...
View ArticleRotate rigidbody2D towards target
I have A lot of gameobjects on scene I need to rotate. They are AI spaceships. However this: Vector3 targetVector = targetPosition - myTransform.position; float angle = Mathf.Atan2(targetVector.y,...
View Article2D Glow/Bloom effect
Hi there, Is there a way how to do similar glow/bloom effect around Planet to this in Unity3D Free? ![alt text][1] I know I can manually draw it in AI or Photoshop, but that is the last resort, since I...
View ArticleChange code at runtime
Does unity have some kind of debug tool? Or when I run the game, change some code, and the game will continue with changes I made WITHOUT resetting all variables and breaking the game. I know it has to...
View ArticleCannot reference object itself
This is kinda strange thing, or I just forget something. I spawn object B from object A. And I make object A parent of object B right after its Instantiation. - Now the problem is, when I try to access...
View ArticleUpdating code at runtime, without loosing all initialized variables
Hi there I know it is possible to update code at runtime in Unity3d. I run the game, change the code, save the script and the game updates itself. **- However my question is: Is there is option or way...
View ArticleChecking area via code or detection collider
What do you think is better for performance? - Thousands of objects checking for enemies around via code? - Or thousands of objects checking for nearby enemies with its attached, say Circle collider?...
View ArticleVisual Studio - Unity problems
I use Visual Studio 2013 Express for Desktops as my IDE. I set it in Unity preferences as my IDE instead of monodevelop. - However, when I upgraded to Unity 5, when I double click on any script, it...
View ArticleGUI 4.6 won`t show on camera
No matter what I do, add button, Image, text, UI will NOT show on camera/screen. It did the first time, but camera was taking only lower left corner of main UI canvas. Like retarded..... I have set...
View ArticleAndroid build - black screen for some devices
I have a problem where I get only black-screen after start up on android(4.4.2) for android build. I test it on Asus MEMO pad K013, here I get black screen. Then I run the same build on my Samsung...
View ArticleCannot reset animation
Hi, I have two states, the animation I want to play, and any state. When the animation should not play, there are 2 transitions controlled by one bool to go from NoState to animation, and from...
View ArticleHow to get this 2D glow effect?
Hi, how could I achieve similar orange glow effect to this? ![https://lh3.googleusercontent.com/-qAKOZbVFmI8/UtEooVJCUTI/AAAAAAAAA8I/WiZ7xi1PR9E/s1600/AsteroidBelts.png][1] I mean glow that is around...
View ArticleInstantiate prefab in editor
Hi, I need to create/instantiate prefab in editor. I know you can use [ExecuteInEditMode] and then just Instantiate(), but that will create copy of the prefab. So when I change the prefab, this object...
View ArticleHow to use array in cg shader
I want to use array in my shader. I know how to pass value: shaderMat.SetFloat("_Sample0", 150); In my shader, I have declared: uniform float _Sample[2]; But when I try to access the values as...
View ArticleSlow script recompile time
My scripts compile at least 40+ seconds when I make some changes. Which is ridiculous. Do you have any idea what may cause it? - Both Unity and Project are on same **SSD drive** - Using only C# - Have...
View ArticleRender with GL lines under Sprites
I googled this problem, nothing I may use so far. I want to render lines inside **OnPostRender()** with **GL.Vertex3()** etc. commands. However, all **lines render Over every sprite**. - tried to...
View Article.meta files not updating - SVN problem
I have a problem where one of the team members **changes prefab`s** sprite reference in it`s script, then saves the scene, saves the project. We look at **.prefab file and it updates properly**....
View ArticleHorrible lag when selection objects in Editor hierarchy
I have around 2000 objects in scene. Each 500 is parented under one parent, so 4 parents and 500 objects in hierarchy. *(I`m not talking about play mode)* In editor scene, when i select with mouse one...
View ArticleHow to free meshes from memory fast?
Hi, I work with chunks created from scratch in my game. - Every time new chunk is created, Meshes are added to memory. - Every time old chunk is removed, Meshes are not removed from memory. This is old...
View ArticleNew Thread sometimes doesnt start
Has anyone experience issue where when you want to run some code in other threads, the threads won run or wont get created when you start the scene (Hit Play in Unity)? I am creating new Thread to...
View ArticlePrevent raycast to OnMouseOver() or OnMouseEnter() when mouse over UI
As title says, it there anyway how to prevent Unity firing OnMouseOver() or OnMouseEnter() functions when mouse is over 4.6 UI objects? Note, this cannot be stopped with...
View ArticleStrange artifacts on Vertex Color Shader
I am using Vertex Color shader for coloring my generated mesh. I have a problem, when I want to reduce alpha of mesh color, e.g. for water, I get strange artifacts on the mesh. **Here is shot without...
View ArticleBest way to handle separate collisions for mouse on all objects?
Hi, this is more of a design question than regular question. I have 3D game, camera is diablo style, top-down. Now, lets say item drops, its small amulet or wood or ring. The player will have problem...
View ArticleAsset Bundle big size
I am packing one Scriptable Object instance into asset bundle. On my disk, the scriptable object has 104kb. However, when I pack it into Asset Bundle, the final bundle has size of 4.5MB, why? I am sure...
View ArticleuNet - need method that is called before OnStartClient()
Hi, I need to call method to generate level before any **OnStartClient()** is called for on players (even Host). But not sure why **OnStartSever()** is not called first, but host`s **OnStartClient()**...
View Article