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

1
vote
1answer
99 views

Unity2D Isometric layering

I'm developing an Isometric Game but I have problem apply the right layer for make, for example, a wall behind or in front of the Player depending on the Player position. I'm able of getting works in ...
1
vote
1answer
1k views

What is the proper way to get input from the motion controllers touch pads?

I've been trying to figure out how to get the inputs from the touch pads on the motion controllers but have yet to find out how to do so. Initially I tried doing the following (as it was how I ...
0
votes
1answer
22 views

Problem with camera drag and draggable UI elements

I implemented my camera drag using the following method: if (Input.GetMouseButtonDown(0)) { dragging = true; followPlayer = false; oldPos = transform....
0
votes
2answers
34 views

Animation clip not working

I am working on playing different animation of key press.Below are the animation element attached to my player Initially run animation is played.I have written code to play "Jump" animation on ...
0
votes
1answer
102 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
2answers
73 views

Projectile Direction Unity

I want to shoot a projectile in the direction the gun is facing. With my current script it only shoots vertically. (I can also make it go horizontally but that's it). This is my GunController class: ...
-1
votes
1answer
61 views

shooting the projectile in the way it is facing [duplicate]

I got my projectile facing the right way thanks to @S. Tarık Çetin. But now I want it to move the direction it's facing. I think I need to use RayCastHit2D but I am not sure. If I need to use ...
1
vote
0answers
29 views

XNA Deserialization Error: XML element “Type” not found

I want to deserialize an xml file that contains a path for an image I have 3 projects: One with the Program.cs class and the main template stuff from xna, another with classes such as the default '...
1
vote
0answers
38 views

How to color individual parts of curve in unity, real time?

So I have a mesh curve that I've imported from Blender. What I want to do is to place individual points on the curve (at fixed distance) and then based on a specific number, color them. Let's say for ...
1
vote
1answer
171 views

How to load sprite from JSON?

i know how to load text, but idk how to load texture from json.. this my c#: public void soalbegin(){ filepath = System.IO.Path.Combine(Application.streamingAssetsPath, "soal.json"); ...
1
vote
1answer
27 views

How can I use a display as a background in unity?

I have a dancing game that I am trying to make and I have a stage where a character dances and a script to switch cameras inside that stage. What I am trying to do is set those cameras to display 2 ...
0
votes
3answers
128 views

A method to create and assign a name to a GameObject (Unity)

I'm trying to create a function that takes in a name of an object in the editor and assigns this accordingly as well as the name of a sprite, rigidbody, etc. Basically what I have so far is- ...
1
vote
2answers
105 views

How to make switch work with enum? C# Unity

I'm working on a script to fade UI elements in Unity, similar to a selector, where you can select the type of fading, and duration, and image to fade I found that enum is the best option to achieve ...
1
vote
3answers
65 views

BoxCollider2D Not Working

So I'm making a copy of noobtuts tutorial on Snake - http://noobtuts.com/unity/2d-snake-game I've done all their steps and am at the point of extending the game solo, however I've an issue with the ...
1
vote
1answer
55 views

Unity 3D - Modify a Script on runtime

I am about to make a programming game for children, hence I will use blocks (like Scratch or Stencyl). My question is: Is there a way that you can modify a script (let's say, by adding a string ...
0
votes
1answer
13 views

Drag event inverts in landscape mode

I am developing an car game for android with an UI steering wheel to control the car. I'm following Answer example for the wheel rotation. This is the code to rotate the wheel. rectT....
0
votes
1answer
91 views

Script for non-stop enabling/disabling “Is trigger” on collliders2d in Unity3D?

I had asked before that I have a problem with too many colliders in one spot and that some upgrades of towers I have are buggy due to that. It has come to my notice, that whenever I enable the "Is ...
0
votes
0answers
26 views

Unity Networking clientRPC not working

I have a networking game in Unity Version 5.4.0b24, but when i call a [ClientRpc] function from server it doesnt work, gives an error like this: Found no behaviour for incoming [ClientRpc:...
0
votes
1answer
51 views

Synchronize objects' movements moved by coroutine function

I'm using Unity version 5.3.5. I'm having problems to synchronize the movement of three different objects from point A to point B and vice versa. To move the objects I use the following code: public ...
0
votes
2answers
4k views

Play animation when click on each player with in maincamera unity3d

I have 3 gameobjects (player1, player2, player3). I attached a script "playerscript" to these game objects. In the main camera, I have added another script called "testscript". Clicking on a player ...
0
votes
1answer
29 views

Mesh Chunk Combining and Extruding

So I'm working on a proceduraly generated level, that is composed of multiple chunks, so you don't go over the maximum amount of verts allowed in Unity Meshes. Another function is the ability to ...
0
votes
1answer
57 views

How can I use web browser controls for non-browser game GUI?

I'm looking for a way to get a modern browser's level of customization and rendering quality in my c# monogame to avoid using roundabout/limited/buggy GUI toolkits and to get better fonts without ...
0
votes
1answer
54 views

How can i show all edges in monogame?

I am using Monogame 3.5 and i have simple model of cube. I use BasicEffect to draw it. I want it transparent so i use effect.Alpha = 0.5f. Is it possible to show all edges something like on picture?
0
votes
1answer
75 views

How can I duplicate this color/hue shifting effect in C#?

I am looking for a way to duplicate this color shifting effect: I don't think it matters but the starting frame would be this: My instinct was that some type of hue shift is occurring in a way ...
1
vote
2answers
301 views

How to properly give Image source for multiple sources?

I'm writing a script to change the image on the button based on previous selection. Another script is giving the CurrentAvatar variable once previous button is pressed. My problem is i can't seem to ...
0
votes
0answers
43 views

Bad practice to create a GameObject for every BoxCollider2D? (Unity)

I am creating a 2D Platformer and need more complex BoxCollider2Ds to be able to handle the collisions (multiple tags, addable & removable properties, etc.). My current solution: Create a ...
58
votes
6answers
14k views

How do bullets work in video games?

I came across this question when I was designing a video game in C#. If we consider games such as Battlefield or Call of Duty, hundreds or even thousands of bullets are flying at the same time. ...
1
vote
0answers
44 views

How to compare two skeletons by using kinect sensor? [closed]

I need to know about how to compare record skeleton with live skeleton in C#. If there are any reference please let me know. example image for what I done up to now
0
votes
1answer
101 views

Obscure primitive data types against cheating [closed]

im trying to create lightweight value obscurer, against possibility to blatantly change primitive values in memory editor. Such as cheat engine. Here's what i have to far. /// <summary> /// ...
0
votes
3answers
81 views

How to find an object which is added to a scene only when game starts?

I'm looking for some advice how to find an object which is added to scene only when the game starts? Before start it isn't in Scene hierarchy. It's prefab.
-1
votes
0answers
20 views

How can I change this script to follow object [duplicate]

I have that script to follow object by camera public Transform target; // Update is called once per frame void Update () { transform.position = new Vector3(target.position.x, ...
-1
votes
1answer
46 views

How to write an event + eventhandler? C# [closed]

Hey guys I want to have an event that would be called "OnMonsterKilled" this should trigger when a monster die so hp = 0. Could you give me some good help? maybe with some explanation I'm not the best ...
2
votes
2answers
248 views

Help on transition from one position to another

I'm pretty sure I'm over thinking stuff, but I can't seem to figure this out. I want to move the object from one location to another. Here's what I got. I searched this up earlier here, and I found ...
0
votes
3answers
82 views

How to do camera follow without drag and drop in Inspector in Unity?

How to do camera following an object with special tag without drag and drop into Inspector? I have 2 prefab model they are not into hierarchy for the moment when player start play. To load selected ...
1
vote
1answer
88 views

Unable to move mouse cursor while pressing keyboard button

I've a player to which I've attached character controller and two scripts - Controller and MouseLooker to control the player movements but when I try to move my mouse cursor while pressing keyboard ...
1
vote
1answer
491 views

How can I use a lookup table for brightness and contrast?

Currently, I implemented a rudimentary brightness and contrast algorithm that changes brightness and contrast pixel by pixel. This was super inefficient performance wise and the algorithm looked a bit ...
0
votes
1answer
150 views

Unity3D - Using AddRelativeForce to push an object forever in zero gravity environment

Ok, I use AddRelativeForce to basically push an object. But it suppose to keep flying and keep accelerating as I hold down the key because I didn't set gravity. I just started Unity3D last month, so ...
0
votes
3answers
918 views

How would I go about making a movement system like Mario Party?

Main question How would I go about getting a movement system similar to the one they have in Mario Party only minus the dice roll? Things I have researched I have been studying the uses for ****...
0
votes
1answer
29 views

How to access triangulates in a 3d model that was imported in Unity?

I have a 3d model of a city. It is in collada format and ina dae file. I imported 3d model to unity but I don't know how can I access the objects of this 3d model with c# script.Because I am new with ...
1
vote
1answer
288 views

How to detect collision position and that position's texture color in Unity?

I have a prefab and I use Circlecollider2D for physics operations. I want to detect the color of the contact position of the collided objects ? Is is possible by using Unity's collider classes ?
1
vote
1answer
188 views

What can I do in Unity3D to optimize the way I'm calculating contrast of a texture2D?

I have this contrast script right now in Unity: public void ApplyContrast(string contrast) { try { double contrastD = Convert.ToDouble(contrast); //Make ...
0
votes
1answer
394 views

Unity3d - c# - changing FPSInputController controls through script

For a game I am making I would like the user to be able to change the controls (in game NOT through the clunky launch window (wich i disabled)) I have the system working but don't know how to change ...
1
vote
1answer
115 views

C# How to add inventory to player, NPCs, and in-game objects?

I'm a beginner in C# and trying to implement a player, an item interface, and some kind of storage system (for player inventory, NPC inventory/drop list, and storage like chests), and having some ...
3
votes
1answer
1k views

Storing items in external data files

My project, in its current state, keeps all of the info for each inventory item in script files. That means, inventory items and their properties are part of the codebase. This works well, but I'm ...
0
votes
1answer
84 views

Covert Minimap render texture to 3d space position

I am using Render texture to make a Mini Map it is working fine but now I want to go further on side map and want world space position from render texture click point. Is there any way available that ...
1
vote
1answer
75 views

Tire mesh rotates faster than wheelcollider in Unity

I have a car in Unity. Scripts are C#. I have noticed that my tire meshes' rotation is faster than whellcollider rotation. I am using this code for wheel rotation flWheel.localEulerAngles = new ...
0
votes
1answer
43 views

(Unity) Player movement script keeps moving

My player in unity moves but doesn't stop when i let go of the key heres the code: using UnityEngine; using System.Collections; public class Player : MonoBehaviour { Vector3 movement = new ...
1
vote
1answer
287 views

Collision detection doesn't register until player sprite jumps

I have implemented a shooting mechanic into my game, and the act of shooting works fine. The shooting work is done in my "game1" class. The issue that arises is when I incorporate collision detection ...
1
vote
0answers
44 views

Moving along the surface of a mesh?

I'm trying to replicate the movement in this game: https://www.youtube.com/watch?v=OcvD8BXars8 The players ship along with all other game elements move along the surface of a mesh. I've tried ...
4
votes
2answers
537 views

Jittery Movement, Uncontrollably Rotating + Front of Sprite?

So I've been looking around to try and figure out how I make my sprite face my mouse. So far the sprite moves to where my mouse is by some vector math. Now I'd like it to rotate and face the mouse as ...