Questions tagged [unity]

Unity is a cross-platform game creation system that focuses on easy art pipeline process. It consists of a game engine and an integrated development environment. The game engine's scripting is built on Mono.

Filter by
Sorted by
Tagged with
11
votes
2answers
13k views

Unity on Facebook?

Hey, I know Flash works using Facebook, and I think I've seen some Java stuff on there too, but does anyone know if the Unity Player can be used in Facebook?
11
votes
1answer
3k views

Confusion about Sprite Size in World Space (Unity)

I have a Sprite with 1080x1920 resolution. And I set the Game View Resolution also to 1080x1920. What I was thinking is that the sprite (1080x1920) should fit correctly within the Camera View. But ...
11
votes
3answers
4k views

How can I make natural rain drops on screen?

I'm trying to make rain effect drop with metaballs and trail on screen.I find a clue in shadertoy but I didn't understand how implemented: https://www.shadertoy.com/view/ltffzl unfortunately it have ...
11
votes
2answers
2k views

How do I customise automatically-generated script?

When you create a script via the Unity editor, it generates a script with some pre-formatted code. ...
11
votes
3answers
30k views

Most efficient way to convert Vector3 to Vector2

What is the most efficient and fastest way to convert a Vector3 to a Vector2? Casting: Vector2 vector2 = (Vector2)vector3; Initializing a new Vector2: ...
11
votes
1answer
5k views

Unity - Order in Z layer for objects

Sorry if the title isn't exactly what my question is, I don't really know how to describe it. I have an image for my city floor and an image (same size) for all the walls or trees that the player is ...
11
votes
3answers
91k views

Does Unity let you code in Java? [closed]

I am fairly new to Unity3D experience , but I have a very good knowledge of Java and Android development. I am really confused that if Java is at all needed for developing android applications? I read ...
11
votes
2answers
21k views

Shader that “cuts” hole through all geometry

How can I create a shader that "cuts" through all geometry, only rendering the clearing background in Unity? An example: That's a prism in a huge white box-shaped room. The surface of the prism is ...
11
votes
2answers
3k views

Check if a game object's component can be destroyed

Developing a game in Unity, I'm making liberal use of [RequireComponent(typeof(%ComponentType%))] to ensure components have all dependencies met. I'm now ...
11
votes
3answers
2k views

How to handle RTS Click-And-Move in 3D Space?

How can I handle the click-and-move in a complete 3D space? It is easy to handle on a 2D plane by a simple raycast, but this is not the case in 3D since there is no end-plane for a raycast to get an ...
11
votes
2answers
11k views

In Unity, why is adding a Vector2 and a Vector3 ambiguous but assigning isn't?

Given the following two vectors: Vector3 v3 = Vector3.one; Vector2 v2 = Vector2.one; This line is ambiguous: ...
11
votes
3answers
6k views

NullReferenceException in Unity

Since many users are facing the NullReferenceException: Object reference not set to an instance of an object error in Unity, I thought that it would be a good idea ...
11
votes
5answers
25k views

2D character controller in unity (trying to get old-school platformers back)

This days I'm trying to create a 2D character controller with unity (using phisics). I'm fairly new to physic engines and it is really hard to get the control feel I'm looking for. I would be really ...
11
votes
3answers
4k views

How can I launch a GameObject at a target if I am given everything except for its launch angle?

I am trying to launch an object at a target, given its position, its target position, the launch speed, and the gravity. I am following this formula from Wikipedia: $$ \theta = arctan \bigg( \frac{v^...
11
votes
2answers
25k views

Does Unity for PC use Direct3D or OpenGL? [closed]

I am a mac developer using Unity and I hardly use a PC. When you build a Unity game for Windows, does it use Direct3D or OpenGL? P.S. I'm not sure if it's called Direct3D or DirectX
11
votes
3answers
850 views

How to simulate pressure with particles?

I'm trying to simulate pressure with a collection of spherical particles in a Unity game I'm building. A couple notes about the problem: The goal is to fill a constantly changing 2d space/void with ...
11
votes
2answers
8k views

How to use the BillboardRenderer in Unity?

Since version 5 (?) Unity has a new component-type BillboardRenderer. Unfortunately the documentation is quite poor. It can be added in the inspector by clicking ...
11
votes
2answers
8k views

Video playback in Unity

I'm not satisfied with the quality of video playback in Unity (Movie texture which I run after converting video with Miro converter and importing it to Unity),... so, is there any chance that there is ...
11
votes
1answer
5k views

Rendering Unity across multiple monitors

At the moment I am trying to get unity to run across 2 monitors. I've done some research and know that this is, strictly, possible. There is a workaround where you basically have to fluff your window ...
11
votes
2answers
9k views

How to await async operations / coroutines?

I'm looking for a generic / reusable way to wait for coroutines and asynchronous operations to finish in Unity 5, similiar to C#5's await keyword. The simplest way ...
10
votes
2answers
3k views

Generate random number in Unity without class ambiguity

I have a problem in Unity (C#) where I would like to create a random number. I wanted to use System.Random (reference: using ...
10
votes
7answers
8k views

How best to structure/manage hundreds of 'in-game' characters

I've been making a simple RTS game, which contains hundreds of characters like Crusader Kings 2, in Unity. For storing them the easiest option would be to use scriptable objects, but that isn't a good ...
10
votes
3answers
2k views

Execute a function for ten seconds and disable it for two seconds

I have a particular function which I am calling in Update function. For the first ten seconds, the function should get called in Update function, then it should get disabled for next two seconds, then ...
10
votes
1answer
11k views

How can I create a height-based volumetric fog?

Recently, I have been looking for techniques to make volumetric fog on some Y position level of the game world. But all I have found are some fog made by using particle system or built-in engine fog ...
10
votes
2answers
6k views

Why do Unity layer masks need to use bit shifting?

I've finally figured out why my layer masks for my ground collision code weren't working. I was using NameToLayer() to get the layer I needed, but layer masks use ...
10
votes
4answers
12k views

How to synchronize a game with music

You may be familiar with ryhtm games as Dancing Line, Geometry Dash, or even Guitar Hero. They have something in common : every single action in the game is synchronized with the music. My purpose is ...
10
votes
2answers
2k views

Season Change Reveal Effect

I was watching the teaser trailer for Seasons After Fall, and I was struck by the effect they use to transition between seasons (around 21-24 seconds): The level art, including the background and the ...
10
votes
3answers
15k views

Unity Android versus android SDK

I am familiar with Unity and in the process of learning android SDK when the announcement about unity android basic came out. What would be the advantages and disadvantages of using the android SDK ...
10
votes
1answer
16k views

Understanding pixel art in Unity 2d

I am struggling to understand the basics behind pixel art in Unity. I understand what a unit is, and that if I draw my sprite with 16x16 pixels, I should set PPU to 16. Take stardew valley for ...
10
votes
2answers
4k views

Is white the best base color to start with when planning to shade sprites within Unity?

I'm looking into prototyping a game in Unity which will consist of solid square sprites / tiles. I figure I can represent different types of objects with different colors for each of the tiles in the ...
10
votes
2answers
20k views

What's the difference between Update and FixedUpdate in Unity, and should I bother?

I was told to use Update() for graphics and FixedUpdate() for physics, but sometimes my inputs won't register when I use ...
10
votes
1answer
1k views

Finding the correct speed for AI to turn to reach goal

I have a ship that travels at max speed maxSpeed and can turn rotationSpeed degrees per second. The ship always moves in the ...
10
votes
2answers
4k views

problem with git on a unity project

I tried to version control my project folder with git. When it came to pull the project from the repository, though, something went wrong: apparently scripts are missing and the prefabs and kind of ...
10
votes
1answer
11k views

Animated textures for models; How to write a shader?

Was watching some Rocket League and notice there was animated decals and wheels. . I would like to implement something similar to the effects in the image above. How would I go about writing a ...
10
votes
1answer
1k views

How can I fix zig-zagging UV mapping artifacts on a generated mesh that tapers?

I am creating a procedural mesh based on a curve and the size of the mesh gets smaller throughout the curve as you see below. And the problem is UV gets zig-zagged as the size changes (it works ...
10
votes
3answers
16k views

Unity: “inconsistent line endings” dialog shows up ever time I open VS with unity

Everytime I open a script file from unity with visual studio this dialog shows up about normalizing the line endings? What does this mean? I click Yes every time but still can't get rid of it. It only ...
10
votes
1answer
38k views

Draw circle around gameobject to indicate radius

I have a tower in my tower defense game im making with an upgradable radius and i would like when the user clicks the tower to show the radius as a circle around the tower My original thought was to ...
10
votes
1answer
562 views

Getting a 2D “pixel” cloud to follow a mouse

I'm working on a 2D game trying to get a "cloud" of a few hundred tiny cubes or discs to follow my mouse cursor without overlapping each other. However, using the physics engine introduces ...
10
votes
4answers
15k views

How to make Line Renderer lines stay flat?

I've noticed that as I add more vertexes to a Line Renderer line the line twists and stops being a smooth line. .GIF Here: http://i.imgur.com/hRAhCXM.gif All lines are on the same z level, even if ...
10
votes
2answers
2k views

Conditional Variables in Scriptable Objects

While using ScriptableObjects, how can I make some variables conditional? Example Code: ...
10
votes
3answers
5k views

Can I run my own loading script during the Unity splash screen?

Can I load data in the background while the Unity splash screen is up? If so, how? I am trying to run code during the splash screen, not just load assets. I have not been able to find any ...
10
votes
3answers
7k views

Accessing DualShock 4 motion sensor in Windows (ideally Unity)

I'm trying to use a DualShock 4's IMU as a motion controller in Unity, under Windows 7. So far I've tried: DS4Windows (1.5.11): reads motion sensor data, but does not expose them to Unity as axes ...
10
votes
1answer
2k views

Determining how loud an AudioClip is

I have some code that uses GetSpectrumData from an AudioSource playing a song to create a level layout for the player to play. I want to add a functionality where ...
10
votes
2answers
2k views

Prototype experience: Unity3D vs UDK [closed]

Has anyone yet prototyped a game in both Unity3D and UDK? If so, which features made prototyping the game easier or more difficult in each toolkit? Was one prototype demonstrably better than the ...
10
votes
2answers
6k views

How do I flatten terrain under a game object?

I've got a script that makes a terrain object and paints it with textures, but I'm having an issue. When I attempt to place game objects (such as the simple water object that unity provides), I use a ...
10
votes
4answers
1k views

Calculating missile trajectory around orbits before shooting

I'm building a game with Unity3D. It's a Gravity Wars clone. Both player and AI turrets shoot missiles at each other (giving an Angle and a Power variables), trying not to crash missiles on planets. ...
10
votes
1answer
173 views

Möbius effect in Unity

This morning I've seen the following animation on Twitter. It is a kind of Möbius strip effect. It's cool! Isn't it? So I've decided to build something similar using Unity, just for fun. I want to ...
10
votes
5answers
32k views

How to create a new GameObject, without adding it to the scene?

I'm creating what is essentially my own prefab system. Game objects are defined by a human readable data file. I'd like to create an empty GameObject, load it with the components defined in the data ...
10
votes
2answers
5k views

Unity Occlusion Portals: What and How?

(Here I eat my words on Meta about posting Unity questions on Unity Answers... since that site is less responsive than this one.) Unity provides cell-based Occlusion Culling (via Umbra, I believe). ...
10
votes
1answer
8k views

Can you embed a Unity3d mobile project into an existing native mobile app?

I am creating an application for both Android and iPhone that will have a few mini games in it. I would like to create the non game section in native Android and iPhone. My question is, is it possible ...