Tagged Questions

Unity is a highly cross-platform engine that focuses on easy art pipeline process and uses Mono as its scripting back end.

learn more… | top users | synonyms (1)

3
votes
3answers
860 views

Two sided sprites

What is the most efficient way of making two sided sprites in Unity's new 2D tools? I'm looking to make playing cards with a backside and a front side.
2
votes
1answer
234 views

Surface shader with VertexLit causes black object

I wrote the simplest possible surface shader: Shader "SimpleSurf" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} } SubShader { Tags {"RenderType"="Opaque" } ...
3
votes
2answers
590 views

How can I create an array of GameObjects?

I need to add one 2d assest multiple times in my scene and I was wondering what is the best way to do this because adding each asset individually and setting there locations doesent seem like the best ...
2
votes
1answer
177 views

Calculating/Predicting a way

I'm just starting with physics, so I'm not always sure about what I'm doing. It's a 2D project but I'm using 3D physical objects like SphereCollider etc.. What I have: Objects floating in space and ...
1
vote
0answers
265 views

Unity : shader that uses mesh.uv to tile texture atlas and mesh.uv2 to tile light atlas

I'm using a texture atlas and a light atlas to tile a mesh. I have the texture atlas working fine. I can apply textures and create a sort of tile map on my coded mesh. At the moment I'm using the ...
6
votes
1answer
202 views

How do I import service references to Unity3D?

I'm attempting access a service reference in Unity. I need two: the SOAP framework and a separate service called ContentVault. The respective service URL's are: SOAP: ...
1
vote
3answers
942 views

Collider2D and Rigidbody2D, how do they work?

I have been learning JavaScript and Unity for a week now. I learned how to make Cube as a Ground and another Cube as a player and I used this code to make the Player Cube move forward and backward and ...
2
votes
1answer
585 views

Unity UV map, tint / change color of texture

I have an array of vertices with texture coordinates for a UV map in Unity: newUV.Add(new Vector2 (0, 1)); // FACE 1 newUV.Add(new Vector2 (1, 1)); newUV.Add(new Vector2 (1, 0)); newUV.Add(new ...
1
vote
1answer
1k views

How should I handle animation states in Mecanim?

I did a tutorial which associated an integer to each state and manually set transitions from one state to another based on that integer, but that seems really sloppy. Is there a more elegant way? I ...
1
vote
2answers
454 views

Voxel Lighting in Unity3D

I'm working on a Voxel project in Unity3D for fun and learning. I've been reading up on how this is done and have implemented a simple Voxel map in my project. My question is about the lighting. I've ...
7
votes
1answer
2k views

How do I programmatically access single sprites when Sprite Mode is Multiple?

Unity 4.3 newly brings an ability to cut up a sprite sheet into multiple individual sprites. This is useful since you then only need one master spritesheet, but nevertheless get references to ...
0
votes
0answers
34 views

Unity: Running code on the “Create Other” menu?

Right now I am trying to create a TextMesh GameObject from code. The graphics primitives are accessible through PrimitiveTypes, I'm thinking there must be something similar, and if not, I could at ...
2
votes
3answers
341 views

How to trust a UDP Client

I'm working on a Unity project with the Lidgren UDP library for connection. I'm new to networking, so I'm not sure on general "best practices" for this area. I'm trying to figure out a good way to be ...
2
votes
2answers
345 views

How can I calculate spotlight lighting in Vertex/Fragment shader in Unity?

I've written a vertex/fragment shader for my game. It uses 3 textures and represents a floating water on the wall (so I have 1 texture for water, 1 for geometry and the last one is mask) so it looks ...
1
vote
1answer
1k views

Procedural terrain - how to blend textures between dynamic meshes

I think I should structure this question better. I'm developing a procedural terrain structured with voxel chunks. Every chunk: contains a NxNxN voxel array generated with perlin noise 3d ...
2
votes
1answer
366 views

What is the license you need to publish to Xbox 360 from Unity3D?

I have a license for deploying and releasing games using XNA. What is the license I need to deploy and publish games using Unity3D, and how do I get it? I have found very little and unclear ...
0
votes
1answer
183 views

Should I use inheritance or interfaces for an inventory system? [closed]

I'm about to start programmin an inventory, harvest and loot system. I will need enemies that drop items, harvestable environmentals that yield resources and an inventory system that takes items and ...
8
votes
2answers
2k views

How can I prevent rigid bodies from moving through each other using Unity's built-in physics?

I'm trying to create a game where objects can be dragged, but I'm having trouble with the physics. With rigid bodies that have similar masses, they sometimes push through each other when dragged and ...
1
vote
1answer
2k views

GUIText size on 4:3 and 16:9 is different

I have a text (guiText) on the screen. It shows correctly when viewed on 16:9 resolution. But it scales up when viewed on 4:3 (e.g iPhone4). I am using following ObjectLabel script to place it on ...
0
votes
0answers
27 views

Creating a dynamic map in Unity [duplicate]

I'm currently working on a small strategy game that involves online multiplayer. I was now planning to add a sort of 'Empire' map to my game. That is, a (3D?) map of different lands, similar to this: ...
0
votes
0answers
179 views

Exporting Motionbuilder mocap data to Unity best practice

I've discovered what I think is the most efficient way to get mocap data into Unity 4.3.4f and was wondering if there was a better/more efficient way. Essentially i'm pulling in the raw BVH data into ...
2
votes
2answers
1k views

Retrieve the original prefab from a game object

How would one proceed to retrieve the original prefab used for instantiating an object? In the editor these two functions work : Debug.Log(PrefabUtility.GetPrefabParent(gameObject)); ...
1
vote
3answers
170 views

Unity, Cannot See Items on the Scene

I am new to unity. I have created an asset by using Blender and managed to put it in the scene. But somehow now I can only see one item at a scene. For example I can only see camera when I clicked ...
0
votes
0answers
153 views

Sprite Rendering Cost Calculation

First of all asking before asking this question I have already read following post for the clearance of my mind. Sprite Renderer Texture 2D I want to change my background texture as per device ...
1
vote
1answer
141 views

Slow Update to improve performance?

For my enemy AI, I only need decision making to be done every second or every half second. Would it make a meaningful difference if I didn't run the analyzing method in the Update, but rather invoked ...
0
votes
0answers
146 views

Dynamic load and unload material

For targeting multiple display resolution, I focus on using MultiPlatform Toolkit usage. In which I found following statement in tutorial section for dynamically handling materials. "Just remember ...
2
votes
1answer
192 views

When one should use events in Unity and how they impact performance?

let's say that inside an OnGUI() script we want to call a method from another script to handle a particular situation. From a prestational point of view, what's the difference between these 3 ...
0
votes
0answers
158 views

Run a few seconds of simulation just after loading a scene

I'm looking for a way to execute 3 to 15 seconds of simulation once a scene is loaded. The problem is: some objects can be left suspended in motion while the player exits the scene. their state is ...
2
votes
0answers
114 views

Design Question, Thoughts on Path Finding for a Galaxy Map [closed]

I am thinking through solutions for a galaxy map. We have different solar systems that need to be connected. I do think a-star (A*) is possibly a good solution but was curious if it was really the ...
0
votes
1answer
725 views

How to clamp player movement correctly?

I have a 2D space shooter game. I looked up some questions from unity community and came across this solution. Below is the code for my player's movement: //horizontal <- || -horizontal -> ...
-2
votes
1answer
173 views

How to know the relative facing angles between two players? [closed]

I want a grappling system similar to Tekken, in which different grapples animations are performed depending on which side of the opponent the player performing the grapple is facing. For example, ...
1
vote
0answers
100 views

Player glitches through floor? [closed]

I'm making a 2D platformer in Unity, and everything is going pretty smooth, accept I can't figure out why my player is glitching through the floor, the player will collide for a few seconds while ...
0
votes
1answer
282 views

Destroying non-monobehaviour derived classes

I'm building an inventory system with different items classes deriving from a 'Item' base class. When an inventory slot runs out of the item it holds I want the item to be destroyed. I cannot null ...
1
vote
1answer
315 views

Rotating a GameObject around its center

I'm trying to rotate a GameObject that consists of several cubes around its center of gravity on an axis. When using transform.Rotate(), it rotates around its pivot point (as shown in picture 1) and ...
0
votes
1answer
3k views

Switch character to play animation() in Unity3D using c# [closed]

I have two or more 2D character (Character A, B, n..). I made an animation on the character using the Animator class "AnimCharacter.cs". if i press the 'PgUp' character 'A' can call the function ...
1
vote
4answers
773 views

Get GameObject to bounce of colliders [duplicate]

I am making a Atari Breakout game with unitys 2d tools and I need to get the ball to bounce of colliders in the scene. If you havent played the game before how it works is if the ball hits the wall at ...
0
votes
1answer
491 views

Problems implementing a 3rd person static camera in Unity3d

I am building a space game that I would like to be controlled in third person. Basically I would like the camera and the ship to remain tied together and remain the same distance from each other but ...
1
vote
1answer
374 views

Unity seperation of prefabs with two dimensional terrain generation

I have the following function: public void Spawn () { GameObject g = ((GameObject)Instantiate (hills [Random.Range (0, hills.Length)], new Vector3 (0.0f, ...
2
votes
1answer
769 views

Create sprite renderer using custom material

I have done following thing. Create Material Attach sprite with texture type as Texture Add sprite renderer component to game object Assign material to it that I create in last steps There is no ...
1
vote
0answers
296 views

Is there an up-to-date Sublime Text 3 package for Unity3D C# completions and snippets? [closed]

I found a couple on wbond, but the only one that's been more or less recently updated has less than 1K installs. Does anyone have experience with Sublime 3 and Unity? I'm mostly interested in 2D ...
1
vote
1answer
236 views

Depth write and depth test in Unity

Scenario: several objects (o1, o2,.., on) have to be rendered with the z test disable, but the z values must be written to the depth buffer. In another pass, some other objects (t1, t2,..., tm) need ...
0
votes
1answer
254 views

Using Appendbuffers in unity for terrain generation

Like many others I figured I would try and make the most of the monster processing power of the GPU but I'm having trouble getting the basics in place. CPU code: using UnityEngine; using ...
2
votes
3answers
1k views

Polygons vs sprites rendering performance in Unity for windows phone 8

I'm currently building a windows phone 8 game with unity, having 111 (no more no less) sprites being updated each frames. I have a strong overhead in the profiler (70% to 90% minimum) I tried the ...
0
votes
1answer
152 views

Create texture the size of my mesh

I programmatically create a Mesh and want to generate a texture that patches coloured squares together so that the patchwork perfectly matches the vertices. The mesh's dimensions are expressed in ...
1
vote
1answer
1k views

Moving rigidbody2d towards mouse click using AddForce

I cant get my rigidbody2d game object to move to where i click the mouse. The first click works. The object travels to the mouse click and stops. But the second time (or the third time) i click the ...
-1
votes
2answers
167 views

Unity score on touch adding up incorrectly

I'm currently working on a game where a user can click an object and this should increase their scored by 1. Unfortunately it seems to be increasing it by more than 1 sometimes and I can't figure out ...
1
vote
0answers
987 views

How can I get this Shader for Unity working with Normal maps? [closed]

So I'm by no mean a shader coder, but I've been hacking around the last few days trying to get working a shader for the sprites of the skeletal animation tool Spine in Unity that can properly use ...
-1
votes
1answer
162 views

lerp z rotation towards mousepointer

I am trying to get transform.rotation.z to chase the mouse pointer at a rotation speed. But I get a very weird results and can't figure out what I am doing wrong. var mp = Input.mousePosition; ...
-2
votes
1answer
185 views

Lerp speed or lerp time [closed]

Am I right about the fact that lerping can be done over a set period of time or at a speed which will continue until the target is reached? How are the formulas for the two? Is it something like ...
1
vote
1answer
302 views

Strange collision behaviour in 2D game even though the collision is very basic [closed]

I have a player ship (cube) and some enemy laser projectiles. When the player ship has position X values greater than 1, collision with the enemy projectiles occur but when it has lower X values, the ...