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

5
votes
2answers
458 views

Black bars on 720p emulator?

I'm making a game for Windows Phone 8 using XNA 4.0 in Visual Studio express 2012. I'm trying to add a background image to the game with a size of 1366x768 (as I believe WP8 only supports up to 720p). ...
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# ...
0
votes
3answers
3k views

How can I make RPC function calls in Unity?

I am making a multiplayer game. I am sending score via the server and client but I want to be sure that can I call an RPC function of a script from any other script. For example, say Table_Manager as ...
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
1answer
84 views

Spawning moving text make it disappear overtime

I am trying to display a text when I click the letter 'R'. When the text appears, it should slowly slide down on the y axis only, slowly disappear over 4 seconds and get disabled. I am not able to ...
1
vote
2answers
406 views

Resetting a level in unity when exiting to main menu

I have a pause screen in my game having two buttons : resume game and exit to main menu The main menu have only 1 button wish is play, when i click on exit to main menu the main menu level is ...
0
votes
1answer
39 views

Instantiated Prefab Facing Wrong Way

Here's a Youtube video of my problem in action ((in the video I am clicking in various directions, yet the fireball is always created facing down in some direction.)) I've been having a lot of ...
0
votes
2answers
51 views

Unity 5: Error when everything is okay(Object reference not set to an instance of an object)

i'm getting this error when the collider colides with something: Object reference not set to an instance of an object It's referencing to the gamecont.Death(); from this script: and the death ...
0
votes
1answer
1k views

How to make custom shaped holes in terrain

So I'm trying to create a game where you fit certain shaped objects into the hole that fits them (similar to the young children's game with different shaped blocks) in Unity 3D. I've encountered a ...
1
vote
2answers
550 views

Sprite collision with color?

Is this possible? To elaborate, I am making a PacMan offshoot. Essentially it is a "zoomed in" version of the game, but the board is randomly generated. I have 11 .png files each to be used as a ...
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
3answers
184 views

Jumping higher when the player touches a trigger collider in Unity

Im using Unity engine to create a 2D platformer. My character can single/double jump, this works fine everywhere except when i am in range of a collider with a IsTrigger set to TRUE, then my character ...
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 ...
1
vote
2answers
2k views

Octrees as data structure

In my cube world, I want to use octrees to represent my chunks of 20x20x20 cubes for frustum and occlusion culling. I understand how octrees work, I just dont know if I'm going about this the right ...
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
2answers
1k views

How to add a UI Text for keeping Score in Unity 5

My Problem is simple I want to show scores on my game. The examples on internet are good but in Unity 5 there are no GUI elements but instead these are now UI elements. I was following this example: ...
1
vote
1answer
5k views

Looking at the mouse position in a top down Unity game?

I'm trying to make a simple top down game where the player looks at wherever the mouse is pointed. The player is only going to rotate on the Y axis. Here's what I have so far but I can't seem to get ...
2
votes
1answer
341 views

delay camera xna

I read this tutorial http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2/Camera_delay.php but i didnot unsterstand it. Is there another way to delay the camera position movement without this ...
0
votes
0answers
35 views

Resize gameObject when it has extended a restricted area

So here i have an image will provide a better understanding of my problem. So currently i have some white blocks and within the white blocks i have some cyan bordered boxes. So the current problem i ...
0
votes
1answer
230 views

How to move the camera in XNA only after few moments?

I made the camera position 10 units from an object, but not behind it. I dont want the camera position behind the object right away when it rotates, I want that when I will rotate the object, the ...
3
votes
3answers
663 views

MMOFPS Choosing protocol for high-traffic network (UDP or TCP)? [closed]

my question about the player position sender protocol. In this article, he says "Never use TCP for networking a multiplayer game". Ok but UDP datas are not ordered. In this case, if somebody walking, ...
3
votes
1answer
349 views

Retrieving model position after applying modeltransforms in XNA

For this method that the goingBeyond XNA tutorial provides, it would be really convenient if I could retrieve the new position of the model after I apply all the transforms to the mesh. I have edited ...
0
votes
2answers
651 views

Shuffle tiles position in the beginning of the game XNA Csharp

I'm trying to create a puzzle game where you move tiles to certain positions to make a whole image. I need help with randomizing the tiles start position so that they don't create the whole image at ...
0
votes
2answers
132 views

How to make a gameobject Scale up from another GameObject script

hi there im having a rought time with this code, trying to make a gameobject grow in scale from touching this one, and when a set amount of scale is reached destroy this game object ( the one who ...
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
1answer
110 views

2D game world engine

I'am starting to develop a 2D game with snake or worm. My question now is: When my snake reaches the right edge the world should move. (Like in this game) My first thought was to implement a camera ...
0
votes
1answer
75 views

XNA Distortion Shader problem

So I came up with a distortion pixel shader in hlsl, but it has some issues. First of all, here is how it works: The shader uses another texture generated by the program as a distortion "map" (if ...
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
1answer
76 views

Unity provides wrong Input value if game is started with bumpers pressed down

As the title states I am having an issue with the following. It is a pretty specific edge case but it is something I can't work around. In Unity I have created two Axes to allow me to check the value ...
2
votes
1answer
565 views

Windows 8 C# Compile spritefonts for MonoGame without XNA

Hello Stack Exchange community. Recently, I've been attempting to in some way generate sprite-fonts into XNB files for use with MonoGame. The issue is however, as you may be aware, XNA is very ...
1
vote
1answer
225 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 ...
0
votes
2answers
1k 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
105 views

Casting a directional line of which an object is coming from

I want to create a directional line ( curve / linear ) depending where the direction is coming from. In some games, similar to Angry Birds, a dotted guideline is shown to provide where the gameObject ...
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 ...
0
votes
3answers
93 views

How to rotate a gameobject to the specific angle

I have tree model that is being rotating .After certain angle it should stop rotating.I have done a sample code.But the tree is not stopping. void Update () { //transform.Rotate ...
2
votes
2answers
101 views

How can I keep AI from getting stuck on each other?

I'm currently working on AI and, as stated above, I'm having trouble figuring out how to keep the AI from getting stuck on each other. More specifically, I'm working on two different behaviors for ...
37
votes
9answers
5k views

How are deterministic games possible in the face of floating-point non-determinism?

To make a game like an RTS networked, I've seen a number of answers here suggest to make the game completely deterministic; then you only have to transfer the users' actions to each other, and lag ...
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 ...
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
1answer
160 views

Unity5 TextAsset not functioning in WebPlayer

Preface I am working on a 2D Platformer in Unity5 utilizing TileMap techniques. I have a working system to read "Room Tile Data" from JSON files with the Unity TextAsset Class and the Newtonsoft ...
0
votes
1answer
176 views

Remove item after crafting

I'm having one last problem with my crafting system. Say an item takes 2 rocks, 1 twig, and 1 vine. When I craft the item, only 1 of each item is removed instead of the correct amount of items related ...
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
2answers
64 views

Detecting on which side did the objects collided unity 2d

I have a ball and a rectangle in my game. The rectangle has a box collider 2d attached to it. How can I calculate or check when the ball hits the top of my collider, when it hits the bottom, left and ...
0
votes
3answers
189 views

Is there a way to scale a texture via GPU rather than by CPU?

For my game that I'm developing I want to have my cards dynamically drawn so if there is any changes done to them it could be drawn on the card itself. What I have currently is that the cards are ...
0
votes
1answer
981 views

Getting a pixel of Sprite at the cursor position in Unity

Summary: I've been trying to figure out a way to use simple box colliders as a nice and efficient "first pass" collider. For the "second pass", I want to check that the area clicked has an alpha value ...
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 ...
1
vote
1answer
842 views

Clipping polygons in XNA with stencil (not using spritebatch)

The problem... i'm drawing polygons, in this case boxes, and i want clip children polygons with its parent's client area. // Class Region public void Render(GraphicsDevice Device, Camera ...
1
vote
1answer
152 views

Voxel engine/vertexes: how to add more and more different textures during game runtime and change some of the blocks' faces?

It's difficult to ask this, but I'll try. The thing is: I asked before somethings about creating ramps and blocks with vertexes. [I'm using C#/XNA.] Explanation: now I got a chunk that has blocks ...
-1
votes
1answer
315 views

How to add nice effects to my menu in Unity

I have a simple menu but I would like to spice it up with some of what I thought would be simple effects. I have 4 buttons that are just rectangle with some GUIText centered on the button and when the ...