C# is a multiparadigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.

learn more… | top users | synonyms

0
votes
1answer
54 views

Move around object

I have problem with Unity - 2D objects. I want to rotate object around circle and on click translate it (with same angle) outside the circle to another and still rotate. Rotating is working with ...
1
vote
1answer
455 views

XNA (BEPU) Physics Performance

Im using XNA 4.0 with the BEPU physics engine v1.2 and I have encountered some performance problems on Xbox. Im not sure if the my mesurements are an expected result of the Xbox (with alot of dynamic ...
1
vote
1answer
36 views

How do you get audio clips to play on all clients?

I am new to networking with so this is probably a noob question. For context I am trying to get a gunshot sound effect to play and be heard by all players.
1
vote
0answers
34 views

My orbit code produces the wrong results

I have a GameObject called "Sun" in the sky. A game object called "GameManager" keeps track of time in the game, it is responsible for updating the hours and days. For my sun I do something like this ...
1
vote
0answers
34 views

I keep getting a type/namespace error when I try to define my two motion controllers. What am I doing wrong?

I'm trying to get motion controls working (particularly making it act like a joystick) but I keep getting this error "The type or namespace name 'SteamVR_Controller' could not be found (are you ...
1
vote
2answers
57 views

Elastically Object movement in unity3d

I want to move an object towards the destination elastically. Currently I am using Vector3.Lerp it working to move the object, start with high speed and reached at destination with low speed but ...
0
votes
1answer
106 views

Unity AddExplosionForce to a Navmeshagent

the navmesh agent is intaracting with the exploding object, explosion occurs and agent takes damage but no pushback occurs. expodingobject using UnityEngine; using System.Collections; public ...
-3
votes
1answer
82 views

best way to handle when a game is active?

I'm facing a problem with a game I'm making on C#. I have a status for the game to decide if it's active or not. However, there are many moments when it must be paused don't have focus a menu is ...
-1
votes
1answer
83 views

create continuous snake like slither.io MonoGame c#

I need help creating a snake with continuous smooth motion like slither.Io up till now I just can't find any but the grid snake. EDIT: Following a curve with the snake, Grow that snake.
1
vote
1answer
63 views

Need Help With My Script And Animator. I am encountering a few bugs with it

Okay so I have created a player archer character which when he using the arrow keys, faces those directions and upon hitting space when in that direction, the bow attack animation is played. The code ...
0
votes
2answers
30 views

How can I get all components of a type from a List with mixed components?

I have a list of GameObjects. Half of these GameObjects have Component1, and the other half have Component2. I want to get all of Component1 from the list. So an example of my list: var list = new ...
1
vote
1answer
13 views

How do I get the InputManager to recognize a certain axis/Vector2D with a Vive motion controller?

Right. So basically I want to map the Vive motion controller touchpads (certain locations) to the certain inputs in Unity's InputManager. How do I do this? Like I want a certain area on the touchpad ...
0
votes
1answer
76 views

How can I access the translation part of a skinned Model object's bone transformation?

I have an animated Model, which I process with the SkinnedEffectProcessor. How I can access translations of that model during animation? It's always a BoneTransform I am working with, but I'd like to ...
3
votes
2answers
271 views

Mock Collision Object in Unity

Problem: I'm trying to set up some tests with mock collision objects, but i cannot construct collisions with custom objects. What I'm trying to do: Collision2D col = new Collision2D(); col....
1
vote
1answer
48 views

Unity Rotation - Object is rotating on Z, but should be rotating on X

I've been working on a project where I have a cube. When swiped left, the cube will rotate 90 degrees the left, and then when swiped right, the cube will rotate 90 degrees to the right. I have this ...
1
vote
1answer
85 views

Creating a list of buttons dynamically in code

I have a list of contacts. I need to create a scrollable list of buttons that are created dynamically so I can add each contact name as the button text. How would I do this all in code? My biggest ...
0
votes
2answers
50 views

smooth loading of the heavy scene in unity3d

I have a very very big/huge scene to load, I can't load it at once. So what I know I have applied but it still loading takes some time I want to make it smooth. How it possible? What i have tried so ...
1
vote
1answer
44 views

Print string letter by letter in UI Text

i'm trying to print a string letter by letter for UI Text of Unity. With each click of a button, the Stampa function, must print a letter. Up to this point everything is working perfectly. But if I ...
3
votes
1answer
26 views

How to edit and persist serializable Assets in the Editor Window?

I have an asset saved in my project which represents a serializable scriptable object. Code of the object is very simple: using UnityEngine; using System.Collections; public class TestScriptable : ...
1
vote
1answer
34 views

Programatically Build List of Custom Class Objects (prefabs)

This seems like it should be a simple thing, but I cannot seem to figure out a method. Currently, I have a public List<MapGraphItem> roomList variable, and in the inspector, I add prefabs from ...
1
vote
2answers
42 views

Randomly instantiate avoiding overlapping in Unity 5

I'm starting a 2D game where I want all the letters A-Z displayed in a random position and, then, the player collects them all in the correct order. I need to randomly instantiate the letters without ...
1
vote
0answers
262 views

How to refresh andoid photo gallery in unity

After saving a screenshot into the folder i cannot view the screenshot in the android gallery but can see the screenshot in the folder created.Is there anyway i can see it through gallery?
0
votes
2answers
51 views

Random Functions in Unity [closed]

Is their a way to execute or call a random function in unity. Something like:- void Update(){random(func1(),func2())} void func1(){print("func1")} void func2(){print("func2")}
-1
votes
0answers
35 views

Toggle between positions in Unity [closed]

I am making a 2D game where an object goes up, down or in the middle. I want to toggle between going down, middle or up on left click but it is not working. So basically what is meant to be happening ...
57
votes
13answers
31k views

What C# libraries can be used to support game development? [closed]

As games are based on many different subsystems things like graphics (DirectX, OpenGL, ...), sound (OpenAL, Ogg Vorbis, ...) or physics (collisions, ...), what libraries do you know that are useful ...
0
votes
1answer
65 views

Set input relative to map rotation?

I'm trying to figure out how I can make the input which looks like this : // Checks if player is pressing movement keys, if is applies force to specified direction if (Input.GetKey(KeyCode....
-1
votes
1answer
53 views

What properties should be private, public, and protected? [closed]

I'm currently trying to write a base player class, and I'm not exactly sure what I should make private, and what I should make public. I know that as a programmer, I need to keep as many variables as ...
5
votes
1answer
1k views

How do i define array in shader's constant buffer with C#?

I am using SharpDX to render 3D graphics and i cannot get to work constant buffer in my shader since it contains an array. Currently it looks like this: cbuffer cb0 : register(b0) { matrix mWorld;...
0
votes
1answer
32 views

2D diagonal movement using Rigidbody2D

I have a problem with 2d player movement, as I am unable to move on the Y-axis. Yet, the movement on the X-axis is working as intended. Below, you can see my code: public Sprite directionUp; public ...
0
votes
1answer
31 views

Transforming position in y-axis (going in the middle) in Unity [closed]

I am making a 2d game where an object goes up, down or in the middle with given Input. But when the object goes to the middle with GoMiddle() it starts glitching and it can't go back up or down ...
0
votes
1answer
346 views

Getting Image name given a canvas WPF

I have a bunch of images I'm using for a chess game in a canvas using wpf, xaml, and C#. I want to use Canvas.SetTop(image, position); to set the position of this image. However I am given the ...
4
votes
1answer
83 views

How do I differentiate between the two Vive motion controllers?

I am working with a Vive Pre (devkit) and I have most everything working the way I want it to. However I am wondering how do I refer to or even know which motion controller is which? From what I can ...
0
votes
1answer
141 views

Creating a Board Game Strictly Using Windows Forms

I'm working on my final project for a Software Design class, and we've been tasked with creating a board game, specifically Risk. Right now, the back-end game logic is functional, however I'm ...
2
votes
2answers
32 views

How to access a prefab's boolean property through collision (with the same Prefab but different Instance)?

I am a trying to recreate the first stage of Super Mario Brothers, but I am having a bit of trouble with the collision system between Koopa Shells. I have written two different scripts in hopes to ...
1
vote
0answers
29 views

Problem in player Rotation in Unity

I am trying to rotate game camera using my android device orientation.Like this Using accelerometer input of device this may be done. But I don't know how to do this. I tried lot of methods, but ...
1
vote
4answers
90 views

Saving with PlayerPref problems

I'm having troubles saving how much of an item I have in my game. Right now I have it so the price goes up the more items you buy, that works, but every time I reset the game, the count goes back to 0,...
-4
votes
2answers
89 views

Trajectory Arcs

Ok so I have read this question Calculating trajectory. And it is sort of working in my program. I am trying to produce nice parabolic arcs with this. Like so .. The results I am getting look more ...
0
votes
2answers
48 views

Transforming Position in y-axis (going down) in Unity

I want the gameobject to go down (position.y) after pressing a key instead of pressing the key repeatedly. So in my current code the object goes down(0.05f) each time I press a key. But I want it to ...
4
votes
1answer
91 views

Find your value between four values in a grid based on distance, Unity

Please note: Originally posted in stack overflow, redirected due to nature of problem. I am making a procedural mesh game. I am trying to calculate the temperature for the player's current chunk by ...
6
votes
4answers
573 views

Get OnMouseDown to work with a 2D Polygon Collider

I'm having a hell of time getting a 2D polygon collider to register a mouse click. I've attached images and code to show where I'm at. I cannot get the click to work. Ultimately, the thing I'm trying ...
3
votes
2answers
72 views

How do you restrict sideway movement in 3D endless runner in Unity?

I have been making a endless runner 3d game and implemented 3 lane side way movement. It's working perfectly, although I want to restrict my movement for the 3 lanes only. If my character for example ...
1
vote
1answer
60 views

Physics2D raycasting with a perspective camera and tilted sprites

So i ran into this problem today. I want to have a perspective camera and sprites that are rotated by lets say 1.5 on the X axis. The problem is that the 2D raycast does not work correctly, it returns ...
1
vote
0answers
36 views

Fixing wave-like movements when rotating an object using mouse input in Unity

I have encountered a rather odd issue with my program. The setup: In my scene, I have a GameObject which I have set as my player/character for this game. The player/character has a child GameObject, ...
1
vote
2answers
42 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
80 views

Texture Editing with Multi-Threading

So I have this giant Texture2D (4096 * 4096, don't ask why) and all its data stored in an array of Colors. When I hit left MouseButton I create a blue 64 by 64 square at the cursor's position using ...
1
vote
2answers
48 views

Tag for Moving platform

My character is not sticking on the platform when jumping on it but I don't know why. Here is the code: void OnCollisionEnter2D(Collision2D other){ if (other.transform.tag == "MovingPlatform") { ...
1
vote
3answers
287 views

Simple way to shoot bullets from a ship at angles for shoot em up

Just like the title says. I'm working on a shoot em up for a personal project, and I can't seem to get this to work. I don't have any code for it, but I do have the code to make my ship shoot, but ...
1
vote
2answers
277 views

animation control problem

I have a list of .FBX object.When I drag that .FBX into scene its corresponding inspector Animation component(fig 1) appears but when I drag some other .FBX object into the scene the Animator ...
2
votes
1answer
1k views

Adding materials to a Line Renderer through code? (Unity)

I have a material that I am using to add a glowing effect to my line renderer. I can add this as a 2nd material to the line to give it a glowing effect. I want to be able to add/remove this material ...
1
vote
0answers
66 views

Polygon 2D collision response- How do I find the correct edge a polygon hit?

Hey guys I've been seriously stressed out by this, so please go easy on me. My goal is to reflect a bullet (polygon) off of another polygon, and find the edge the another polygon, A (the bullet), hit....