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.

learn more… | top users | synonyms (2)

-1
votes
1answer
46 views

Unity: When attaching my custom camera script camera shakes when player starts to move fast

Here is my player code. Rigidbody rb; Vector3 currMovement; public float jumpSpeed = 10; public float moveSpeed = 10; public float rotSpeed = 180; float distToGround; public float posSmoothTime = ...
1
vote
0answers
24 views

Unity play sound from Audio Source

I'm using the following code to play a sound in Unity 5: AudioSource aud = GetComponent("doorSound") as AudioSource; aud.PlayOneShot(aud.clip, 1.0f); But no sound is playing at all. What am I doing ...
1
vote
1answer
59 views

Full Engine or Not: C++ Programmer Trying to get into Game Development [closed]

I'm a fairly experienced programmer, and I want to try out doing some game development. However, I am unsure of whether or not to use a full engine like Unity or just start with something like OpenGL. ...
1
vote
1answer
27 views

How to use Resources.Load with an AudioClip in Unity?

I'm trying to load an audio clip that's in my assets directory and play it. Here is my C# script: if (Input.GetKeyDown(KeyCode.X)) { audioSource = gameObject.GetComponent<AudioSource>(); ...
0
votes
1answer
38 views

Unity 2D C# Enemy Attackng Ai issue

Ok to be specific, both of my enemies will continuously play their attack animation even when it is false. I don't understand what I am doing wrong here :( void OnTriggerEnter2D(Collider2D other){ ...
0
votes
1answer
47 views

How to calculate 2D viewport coordinates in a shader?

In Unity, I use the following shader to calculate 2D viewport coordinates : Shader "Foo" { SubShader { Pass { CGPROGRAM #pragma vertex vert ...
-4
votes
0answers
29 views

Is there any way to have a Character Controller be pushed by a rigidbody?

Noob question, any help appreciated. Thanks
1
vote
0answers
26 views

Unity: Implementing Fall with Animation

I have a character controller. I am primarily using FSM with the animations and blends. However, I am running into some trouble with the fall. I walk up to a ledge and walk off...sometimes I will ...
1
vote
1answer
38 views

Check rotation before rotating

I am making a puzzle game in Unity. I have several GameObjects that have children objects where each child object has a BoxCollider2D. The game requires that the pieces be rotated, but to position ...
0
votes
2answers
35 views

Unity Non-shader method of combining two RGB Textures into a single RGBA Texture

I work in a broadcast environment that delivers video signals over SDI as Fill (RGB) and Key (A) signals. My SDI rendering method produces a Texture for each SDI input and applies it to a material. I'...
1
vote
1answer
30 views

Unity Surface Shader: Conditinally noforwardadd

I'd like to have this in my shader: #if SHADER_API_MOBILE #pragma surface surf Lambert noforwardadd #else #pragma surface surf Lambert #endif But this tries to compile both #pragma surface and ...
0
votes
1answer
17 views

Unity: Increase animation speed of individual component in a blend tree?

I have blend tree with four different turns: a sprinting turn, running turn, walking turn, and standing turn. I need to somehow make the angular velocity increase from sprinting down to standing, ...
0
votes
0answers
19 views

a good way to save eddits on game in unity [duplicate]

im going to add a feature that lets player edit a map and put objects there and... i want to know how can let him save the edits for starting a game? for example a player puts player spawn tanks ...
0
votes
1answer
23 views

Disabling object OnCollisionEnter and Enabling it On Collision exit

I have two objects that when they collide disable another gameobject. The problem is that I only want to have the other game object disabled while the two objects are touching and that I want to have ...
2
votes
1answer
111 views

How to add constant force to player with sperical gravity planet.?

I have a planet and character. My player move perfect around planet with pressing key like 'w','s','a and 'D'. I want to move my player on every frame with same force around sphere. I try plane ...
0
votes
0answers
19 views

Unity - Renderer.Bounds equivalent for GameObject without Renderer

I use a modified version of the 'Poor Man's Nested Prefab' script, it renders prefabs without using meshrenderer. Unity recognises it as an empty gameobject, so default focus distance (when I press f ...
0
votes
2answers
87 views

Android game to iOS, go with an engine?

I have developed a game on android using native coding. However I am being asked to port it to ios. So I thought that I should bite the bullet and recode it in unity so I can go cross platform. I ...
0
votes
1answer
41 views

Streaming webcam via websocket performance issues (Code included)

I finally figured out, how I can stream my webcam, but I'm getting not the best performance. In low resolutions it's working fine, but as soon as I turn the resolution up, the performance gets worse. ...
0
votes
1answer
23 views

Unity3D: Sudden lighting change in a scene

Sorry if this is a duplicate question, but I have no idea what this would be considered. Hello, I have recently been creating an FPS game, but while researching some things on the internet, the ...
0
votes
2answers
33 views

Updating GameObject Position in Unity 5

I have a simple Sprite called Player that has the follow components (Transform, Sprite Renderer, Box Collider 2D, Rigidbody 2D, Player Controller Script). In my Player Controller script I want to ...
-1
votes
0answers
23 views

How to move player with animation around shpere.?

I have a script modified by me. In my script i can not move my character with rigidbody.AddForce, Why i don't know but just play only animation not moving to forward. So I use rigidbody.velocity but ...
1
vote
0answers
29 views

Mesh vs LineRenderer Performance

I've created a script, which is drawing a line along a bezier curve, so that I can animate whatever I want with lines, mostly for UI purposes. For the moment I'm using a line renderer, which works, ...
7
votes
2answers
90 views

Conditional Variables in Scriptable Objects

While using ScriptableObjects, how can I make some variables conditional? Example Code: [System.Serializable] public class Test : ScriptableObject { public bool testbool; public string ...
-4
votes
1answer
55 views

Unity c# - NullReferenceException: Object reference not set to an instance of an object [closed]

This is driving me crazy. I am new to C# and I always get this error when playing while it seems like a very simple code. I get the error at this line NullReferenceException: Object reference not set ...
0
votes
1answer
46 views

Unity 2d sprite repeated as background

I'm a web developer with over 12 years of experience and I'm moving my first steps in game development in the latest days. Specifically I'm playing with Unity and trying to understand how it works and ...
-6
votes
1answer
63 views

Is this shader can exist in Unity?

'Front' and 'back' are all SpriteRenderer. Do you have a Shader these things that will be present in the Unity?
0
votes
1answer
14 views

unity shader : Applying ZOrder to sprite renderer conditionally

here's scene object info of above figure. all of object's renderer is 'SpriteRenderer', and Material is 'Sprites-Default'. [A (Car)] OrderInLayer : 302 Local Z Position : -9.8 [B (Land)] ...
0
votes
0answers
28 views

How to properly Start Stop a Particle System?

I'm using Unity 5.3x for a game. I've a Prefab with the following structure hirerchy of object MyPrefab -> MyContainer -> NitroEffect -> NitroFlamethrowerFire I'm having problem on how to Play Stop ...
-1
votes
2answers
111 views

Control Unity Game loop to sync with external hardware/software

We would like to run the Unity Game Loop in sync with external hardware and applications running on a different computer. We want to arrive at something that work similar (but does not have to be ...
1
vote
0answers
125 views

In game replay system doesn't work correctly when animations are used on a character

I have created an in game replay system that essentially just stores each object's position and rotation at each FixedUpdate(). Once an even is triggered, the replay is then played back using ...
1
vote
1answer
35 views

Damping the Camera “lookAt” rotation

I have created a very short piece of code to make the camera look at a transform object. I locked the rotation of the x and z axis as it is only supposed to rotate on the y axis. I would like to add ...
4
votes
1answer
80 views

How to keep sprite on screen while increasing its width to screen width

I have been able to increase the width of a sprite to the width of the screen size, but the sprite exceeds the borders of the screen width to the right or left when I try expanding it when it's not at ...
-1
votes
3answers
133 views

A python script controlling a Unity game

I wish to build a simple game in Unity such that the objects in the game can be controlled via a Python script (or a code in any other programming language). Is this possible? If yes then how? If no ...
1
vote
1answer
81 views

How should I animate sprites with separate body parts?

I am not an artist. I have a 2D Sprite broken up into different body parts that I want to animate. I know how to do it in Unity, but every artist I know would prefer to use Flash. I am trying to ...
-1
votes
1answer
29 views

How to merge VRPN and Unity

I'm new to virtual environments, having worked mostly with Arduino and other physical applications. I'm trying to set up VRPN server on one of the computers in my lab to pass some triggers from a ...
0
votes
0answers
38 views

How do I make an object not appear grey regardless of distance?

My moon texture is on a plane 500m away and I would like to know if there is a way to keep displaying the texture: As opposed to it turning grey as pictured here: regardless of the distance it is ...
0
votes
1answer
26 views

Animation inside a .obj file?

Ok, so yesterday I understood that "rigging (bone and joints)" are things that are use inside a 3D animation software like maya. By that I mean that those bones and joints are not inside the .obj file ...
3
votes
1answer
33 views

In Unity, how can I get trigger enter/exit every frame when I change Time.timeScale?

In my game I have a power-up that slows everything down. I keep the player at regular speed by dividing deltaTime by timeScale. Everything works perfectly except for OnTriggerStay2D which appears to ...
3
votes
2answers
382 views

What revenue cuts will I take by using Unity combined with Facebook's platform?

Basically me and a friend want to develop a Facebook game by using Unity. What I wanted to know is if we do earn any money on it, how would we be required to use the profits of said money? I remember ...
0
votes
0answers
20 views

How to use touch.deltaPosition properly?

I use following code for measure touch delata position: private Touch firstDetectedTouch; public Vector3 dragDistance; void Update() { if (Input.touchCount > 0) { ...
0
votes
0answers
10 views

How do I add EventTriggers to Multiple instantiated prefabs from a list?

I have a prefab which I am spawning a dynamic amount of. I want to attach an event trigger to each one of them, on pointerclick, to call a method accepting an int as parameter. I have the following ...
-1
votes
0answers
18 views

object is not smoothly moving using lerp and onMouseDrag

This is the code to move my object using lerp and mouseDrag event but it is not working very smoothly. //Camera Point smooth movment if (mouseWorking) { if ...
0
votes
1answer
28 views

World Space canvas rendering in front of line mesh

I'm attempting to attach a pointer to my steamvr controller to simplify world interactions. I'm very new to unity, but found a nice volumetric line asset (VolumetricLines) that aesthetically is ...
1
vote
1answer
40 views

How to animate material change to get a status bard effect, in unity

Imagine a long cube, like a bar, that has a dark material, and you want to animate changing its material to a light material, but do it gradually from one end to the other, like filling up a tube, or ...
0
votes
0answers
28 views

Unity 2d variable has not been assigned when trying to instantiate

So I have some code here: using UnityEngine; using System.Collections; public class boardManager : MonoBehaviour { public GameObject GrassTile; void Start() { for (int i = 0; i <...
1
vote
1answer
54 views

Should camera rotation be framerate independent?

I currently have my own custom first person controller, and the code to rotate the camera and controller based on the mouse position deltas looks like this: public void ApplyRotation() { this....
0
votes
0answers
14 views

Moving parts of animated mesh by code

I have a skeletal animated GameObject consisting of multiple meshes. Now one of the meshes rotation should be controlled by code. How can i do this in unity? Imagine a human head with a lot of ...
0
votes
1answer
74 views

How to keep a rigidbody on the ground going up/down a slope? (Unity 2D)

I'm not sure if this is possible, but Im working a 2D project to has randomly generated loops (imagine a sin or cos graph). I have a 2D character (a quad for now). I want my character want to ski a ...
0
votes
0answers
23 views

Get relative angle to collision Unity

I want to get the angle between the rotation (euler Angles) of the camera (V1 : Vector3) and the collision point of my character, when it hits a wall, to determin, if it was left, right, or in front ...