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
0answers
15 views

C# wall hitting problem [on hold]

Hey guys so for my 2D game in order to switch levels I chose to say when my player reaches the end of the screen of the right side he will switch levels. But I have four levels and when I hit the ...
0
votes
0answers
18 views

How can I restrict rotation about the intersection point to right angle intervals?

Right now, I can draw two line segments and then rotate about the intersection point using one of the line endpoints or by dragging the whole line about the intersection point. I can scale my line by ...
4
votes
1answer
44 views

Torus World Collision Dection

I am looking for a collision detection solution for use when 2d screen wrapping. Specifically, when the image is split between the right and left side I can only detect a collision for a limited ...
0
votes
0answers
31 views

XNA C# - Unhandled exception of type 'System.NullReferenceException' [on hold]

I'm making my first game (as part of my college course) and I have to make it in XNA using C#. My issue is that I'm trying to make a main menu, and after following a tutorial pretty much to the ...
3
votes
3answers
71 views
+100

Authentication between client, central server, and player ran server

I am developing an open source game that uses a client-server scheme similar to Minecraft. We will control the central authentication server that verifies an account is valid, while players will run ...
0
votes
3answers
54 views

How to check distance between two different vectors?

So I have a very basic racing game, where I would like the car to stop once it hits the finish line. Respectively when the distance between the car and the finish line hits or goes under 0 the car ...
0
votes
0answers
21 views

Looking for inspiration for a Mafia Wars type game [on hold]

I'm creating a game that is browser based and without 3D graphics. Basically its going to just be a text-based game. I'm at the very begging of this process, I want to write down a flow chart before I ...
3
votes
5answers
1k views

Trying to implement gun cooldowns in C#

My aim is to allow my player to shoot 3 bullets at a time. Between shooting these 3 bullets the player should wait a very small interval (so that they don't all get fired at the same time) - call this ...
0
votes
1answer
24 views

Touch Input with Event Trigger. How to handle with it properly

Hello Community, Since this is my first post I wanted to say hello. As every beginner developer I have a lot of problems. Below one of them: I wrote simple script to control my 'Player' object: ...
0
votes
2answers
99 views

Basic C# Script in Unity3D for firing a bullet (not working)

working on a 2D top-down view game. Im trying to get my player to fire a bullet when spacebar is pressed. I added a component to my player (a bullet sprite) and placed it under his gun (so you can't ...
0
votes
2answers
56 views

Moving a character depending on the direction he is facing (C#/Unity3D)

Right now I have a small soldier on the screen that moves with W, A, S, D and rotates / changes direction with the arrow keys. What I want to happen is when the player's direction changes (by using ...
3
votes
2answers
68 views

Creating a countdown Timer in Unity

I want to create a countdown timer in a Unity game I am creating. Up until now my game was running for a specific time but I was using InvokeRepeating to end the game after the set time. But now I ...
1
vote
0answers
19 views

Supported Orientation, Monogame, Windows Phone 8

I am developing a game in which I need to rotate the screen on Landscape mode or Portrait, and lock it that way. In Monogame, targeting Windows Phone 8.1 adding this code: ...
1
vote
1answer
29 views

How to properly activate trigger objects?

I have made a flying cat that follows the player, but I want the cat to be a separate object. Cat is following the player and as soon as it sees a collectible it grabs it for the player and then ...
-1
votes
0answers
13 views

C# Xna , projectiles moving towards cursor problem [closed]

Hey i tried to make a program that evolves a character shooting projectiles toward the mouse cursor but i ran into a problem that i don't know how to fix. My character rotates fine towards the cursor ...
0
votes
1answer
39 views

Why is C# method not showing up for button's On Click()

I have a C# script called MainMenu.cs Here it is in its entirety using UnityEngine; using UnityEngine.UI; public class MainMenu : MonoBehaviour { public Button btnPlay; // Use this for ...
0
votes
1answer
72 views

CPU Usage and Available Ram in Unity 5

In Unity 5 I would like to be able to print out the CPU Usage and Available Ram left in MB. I followed the code posted on http://zamov.online.fr/EXHTML/CSharp/CSharp_927308.html and used it, however ...
2
votes
0answers
28 views

Cannot convert bitmap to texture

I'm doing a little C# / OpenGL project and I can't manage to load textures properly. So here is my texture class : public class Texture { public String Filepath; private int TextureID; ...
0
votes
1answer
57 views

Unity 5: Accessing a C# variable from Javascript

I've set up a SQLite database with Unity. Into this I would like to add the current CPU Utilisation. The SQLite scripts are in Javascript and the method for finding the CPU utilisation is in a C# ...
1
vote
0answers
41 views

Overriding all object inspectors in Unity

How can this be done? I want to add a single label to every component( including non-misbehavior ones ) in the inspector. I've tried: [CustomEditor( typeof( Object ) )] And: [CustomEditor( typeof( ...
0
votes
0answers
33 views

Saving a c# script in a javascript variable(unityscript) [closed]

i am modifying the inventory system made by brackeys. https://www.assetstore.unity3d.com/en/#!/content/10384 Now i want to define a c# script into a variable inside the character.js file. It looks ...
1
vote
2answers
80 views

Accessing a newly Instantiated Object

I currently am creating a script that allows the player character to attack by shooting orbs at foes. I have the current code to do that (not final code, for testing purposes): ...
2
votes
1answer
48 views

Does the order in which RPCs are called match the order they are invoked locally?

For example: void A() { Debug.Log( "A was called." ); } void B() { Debug.Log( "B was called." ); } void C() { NetworkView view = GetComponent<NetworkView>(); if( view != null ) ...
0
votes
1answer
80 views

Unity how to change material properties at runtime

I'm working on a unity game where I want to change the color of a material from within a script. The material applies to a line renderer. I currently have the following script: using UnityEngine; ...
1
vote
0answers
51 views

Why is my c# quadtree so slow when loaded without doing anything? [closed]

I have a WPF canvas with about a thousand DrawingVisual. I've made a quadtree for lazily loading the DrawingVisuals when they are scrolled into view. My quadtree design seems to be faulty. By just ...
0
votes
0answers
20 views

Rich Text on InputField breaks Content Size Fitter functionality. Need some help

I'm currently using the input field as a way to make normal(ish) text in Unity. Refer to this question for more detail: How do I go about making a text box that allows for highlight-able and copyable ...
1
vote
0answers
19 views

How do I manually submit a new UI InputField in code?

I need some conditions for submitting the text inside of an Inputfield, however I cannot find a way to do this via code. I was expecting something simple like with WPF or WinForms, but I cannot find ...
1
vote
1answer
29 views

User extendable content with Contentmanager

I developed a towerdefense game that uses xml-Files for almost everything, (creeps, levels, towers, upgrades). Those Xml-files define properties like textures, sounds and values like hitpoints. My ...
0
votes
0answers
14 views

Entity interpolation with a Unity listen server

How can this be done? I've implemented client side interpolation but I'm at a loss on how to implement it on a listen server. In order for the listen server player to see the same thing as the ...
0
votes
0answers
11 views

Applying Image Effect to specific texture uploaded and not to both texture and background

Hi I was following this script and shader example for brightness, contrast and saturation. I was able to follow along by attaching the C# script to the main camera and the shader to the script object. ...
0
votes
1answer
27 views

Unity 2d - Destroying foreign object from script + seek explanation about destroying objects

I have simple emmiter which sending enemies toward player in center of screen. Player can shoot missile (also emmiter). I want to destroy enemy AND missile in same time. Here is my code attached to ...
0
votes
0answers
16 views

vuforia unity how to detect that we have “ lost track of” an object

I'm working on a vuforia project and would like to be aware when vuforia can no longer detect the object in unity. Is there an easy way to write a script that is executed opon loosing track of an ...
1
vote
1answer
41 views

Find distance from Vector2 to nearest point in Rectangle

I'm setting up collision detection and I have Walls which store their positions as rectangles. I need to figure out the distance from a Vector2 to the nearest side of a rectangle. If this was two ...
0
votes
1answer
93 views

How to move an 2D character(with animation) to mouse click position in C#?

i am going to develop a simple game called waste collection.In which if i click on a waste the character needs to walk to certain waste and collect it. Startingly the character is in the middle ...
0
votes
0answers
28 views

WebCamTexture.width and height returning 16,16 unless reinitialized

I am trying to store a picture from a camera with WebCamTexture. The function Savepicture(string path) uses a Texture2D to set pixels retrieved from the WebCamTexture class field, I end up getting a ...
1
vote
0answers
78 views

Mega-man 2 Camera help (Unity) [closed]

So I have tried several ways to fix a Mega-man 2 camera without actually figuring out a good way of doing it. So I would love if someone could give me some tips for I could solve this issue. The ...
0
votes
0answers
41 views

Trying to increase the size of a sprite when it touches a pellet in Unity with C#

This is my first game, and I'm trying to keep it simple, so just a simple platformer that works around the size of the player's character, and the character increases in size whenever they consume a ...
0
votes
1answer
40 views

finding a path from one point to another with obstacles help

Im building a tile based game and im implementing my path finding algorithm. Currently, it can find a path from point A to point B with no problems. However, if there are obstacles between point A and ...
1
vote
1answer
26 views

6DOF camera: inverted yaw and roll when orientation changes

Whenever I change the orientation of the camera, yaw and roll become inverted (or correct); the strafing, movement and pitch do remain correct however. Can you tell what is causing this and how to ...
0
votes
1answer
30 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 ...
1
vote
3answers
142 views

Basic multiplayer matchmaking implementation

I am currently writing a matchmaking server application for a 5vs5 UDK game. Here is the scenario on which I built my code: The player starts the game and authenticate The player clicks an huge ...
0
votes
1answer
19 views

Unity - How To Customize Buttons Graphics

inside my buttons I added some variables (as you can see in the code below). public UnityEngine.UI.Text itemInfo; void Update () { itemInfo.text = itemName + "\nCost: " + (costo_stringa = ...
-2
votes
1answer
44 views

how to change trail renderer start width dynamically by script in unity?

I created a prefab that contain a trail renderer to make a drawing sprite in GUI, then i put it into a gameobject in a script. I want to change the start width or end width of the trail renderer ...
0
votes
1answer
73 views

How do I make the ui button to move my character? [closed]

How do I make my character move left,right and jump when click ui buttons using this code? using UnityEngine; using System.Collections; public class Player: MonoBehaviour { public float maxspeed = ...
0
votes
0answers
21 views

How do I make Ground Check stop rotating with the character when it rotate? [duplicate]

How do I make my character routice without Ground Check rotating with it, but still follow my character? Code: using UnityEngine; using System.Collections; public class Player: MonoBehaviour { ...
2
votes
1answer
50 views

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

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 ...
2
votes
2answers
64 views

How do I calculate rotational impulses in rigid body collisions?

I'm writing a simple 2D physics engine to help me understand the inner workings of physics engines. I'm following Randy Gaul's tutorial which can be found here and It's been extremely useful and ...
0
votes
1answer
28 views

Unity - Scroll Rect shows buttons outside of the rectangle

I have this problem. I'm using a scroll rect to display a series of buttons, but I would make sure that as soon as the buttons (with the scroll rect), come out of a certain area (bounded by a panel), ...
0
votes
0answers
17 views

Character fixed angle? [duplicate]

I want my character to rotate so I turn off fixed angle in Rigidbody 2D, but the problem here is that I can't jump in any other angle except for the angle where I have my groundcheck. Can anyone help? ...
0
votes
1answer
27 views

Send a prefab over network in Unity

I want to instantiate an object on only the server and one client. This means Network.Instantiate is out of the question and I have to instantiate it manually. Since Network.Instantiate takes a ...