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

Questions about scaling in a 2d game in unity

Okay, so: I am making an android game. I want everything to scale to the size of the screen I'm using. Further, my static background needs to scale (as well as every other object), but if the aspect ...
0
votes
2answers
28 views

Refer to a gameobject on start

So I want my script to set the initial position of an object depending on the size of the screen and whatever. How do I refer to the gameobject? I know you can modify stuff like their location if the ...
1
vote
1answer
21 views

Check if object is overlapping

I have two objects, both of them with polygon colliders. When I click on one of the objects, I want the player to drag it on top of the other object (without collision). If there is overlap when he ...
0
votes
1answer
61 views

A* Pathfinding for Procedural Platformer Levels

Im trying to write code a my Procedural Platformer Game , but i have no idea where to start. Ive looked up A* Pathfinding in general, but i cant seem to find A* Pathfinding with Procedural Platformer ...
0
votes
0answers
8 views

Pooling server list from unity's masterserver

I'm making my own server (C#), that will run separately from the unity game. So that you can host a server while not playing. I could create my own master server, but is it possible and how would I ...
1
vote
1answer
33 views

Unity import text or json

Can't seem to find a definitive way to import text to C# in Unity3d. I'm looking to import either a lot of different text files or one large json file to represent all the text in the game. Thanks ...
-1
votes
0answers
14 views

Why does Unity ignore my Debug extension method? [on hold]

I have created an extension method for Unity's Debug.Log using UnityEngine; public static class DebugExtension { public static void Log(this Debug debug, string label, object value) { ...
0
votes
1answer
29 views

Can’t Load .fbx from blender to Monogame correctly

I am using pipeline.exe tool, to convert an .fbx file I made using Blender (using the default Blender 2.73a export settings) to .xnb, and then manually copy and paste it in my content directory (Is ...
1
vote
1answer
36 views

How to call a method from another c# script using invoke?

I want to call a method from another script in my script using Invoke(),but unable to run it.How can i achieve this ? Following is my code - void Start () { int randNum; randNum = ...
0
votes
0answers
12 views

Game Center Leaderboards in Monogame

Do anyone know how to integrate a game center leaderboard in monogame framwork... I have searched high and low yet I haven't gotten any luck of finding articles that might help... Please direct to ...
0
votes
0answers
14 views

Displaying intersection by removing vertices

I am using WPF, using the MeshGeometry3D class to build up my model. I have 2 pipes intersecting each other, and I would like to remove the region of intersection (meaning erase the portion of pipe 1 ...
0
votes
0answers
18 views

Adding Player Movement and Firing on Touch Input (Unity)

I am having many problems with this. I am a new game developer and I am using a Unity tutorial. But I want to add touch input for movement and a touch button for firing the weapon. How can I do this? ...
0
votes
2answers
38 views

Using shader for cubes

I am trying to use a shader to get an effect like this. Notice how every cube has exactly the same lightning as every other no matter where it is on the screen if you look closely the lightning is ...
1
vote
1answer
54 views

How do I let a game support different rule sets?

I'm making a MUD game engine that supports D&D , Pathfinder and other tabletop-RPG rule sets. I am starting to build out how characters interact with the world (e.g. dialog, battle, searching for ...
0
votes
1answer
26 views

XNA draw texture/font and DrawIndexedPrimitives at the same time

When i Draw a texture2d or a font with spriteBatch and also draw GraphicsDevice.DrawIndexedPrimitives, the frame is draw weird SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice); BasicEffect ...
0
votes
1answer
36 views

Help with understanding “transform.root.GetComponent<>” in Unity

I'm reading through a tutorial for making an RTS in Unity, and in certain scripts it wants you to make a Player field and then OnStart(){ transform.root.GetComponent}. I am not quite getting what that ...
0
votes
3answers
58 views

Drawing 3D cubes with xna

I managed to draw a 3d cube using triangles like this: protected override void LoadContent() { basicEffect = new BasicEffect(GraphicsDevice); VertexPositionColor[] ...
0
votes
0answers
21 views

Arrange Jumble Word into English Word

Actually I want to make a Game. Game is very simple. There are 5*5 matrix with Jumble words and player needs to arrange those words into proper English Word. I have done small part of ...
2
votes
2answers
150 views

How can you subscribe to Unity input events, instead of polling for them

Been trying for days to figure out if there is a way to subscribe to keyboard/mouse events in unity. Instead of having to poll for them every frame and make my own events. Right now I poll through ...
5
votes
4answers
702 views

Creating an in-game time system only works with real time

I'm trying to create an in-game time system. Thus far it only works properly if you use 1440 minutes to the day (realtime), but I would like to be able to alter the day length to something like 10 ...
1
vote
2answers
55 views

Unity prefab script “GameObjects” can't be ones on the scene?

Currently, I have an object on the scene, and one in prefab. I want the prefab's script to reference to the object on the scene through the public GameObject obj; code. However, when I tried to ...
0
votes
2answers
65 views

Accessing colliders from one script C#

I want to access specific colliders(to see if they are been clicked) from one script insted of making multiple scripts for every collider.How? I am using unity. using UnityEngine; using ...
0
votes
1answer
44 views

How can I add banking and rotation to this object manipulation script?

I have made a drone script that allows user to move in four directions and ascend/descend. I found a nice tilt snippet which makes the thing bank when it moves. However, when I include this, the ...
0
votes
1answer
60 views

Unity, Why a Text object can't be edited?

I have an input field and event that calls a function when I press enter. public Text theText; I take the Text part of the input field (connect them in editor), display the content and set new ...
0
votes
1answer
63 views

Rotate camera keeping player not in the middle

Here I have a 2D top down game. Currently the camera is set on the player position. The player constantly points to mouse position. I want to modify this setup having the camera to be set slightly ...
0
votes
1answer
49 views

Multiple models not drawing

I got Camera, Terrain and player working, moving around, etc. When I try to add another player (another model to draw) it just dont any of the models. Here is my code; public class World { public ...
-1
votes
0answers
72 views

FPS Drops From 59 to 29

I am creating a 2d platformer and I am getting fps drops from 60 to 20. It might be my collision code, but this was the only way I could get it to work with slopes. private void CollisionCheck() { ...
0
votes
3answers
122 views

Drawing image with an angle

Edit: the images below aren't supposed to have whitespace. I am just trying to show you that i am trying to create a rectangle from a 1x64 image, positioned as shown in the second picture I know how ...
0
votes
1answer
82 views

Lightning bolt effect with particles is not continuous

I am Drawing a lightning effect animation using this image: Below the result: As you can see the outcome is not a continuous purple color as I wanted it to be, but it has black spaces in ...
-1
votes
1answer
45 views

How to remove the jitter from my pong AI movement?

I am developing Pong using Monogame / XNA and my AI paddle is really jittery when the ball is moving more horizontally than vertically. My AI is very simple and works as follows: If the ball's ...
0
votes
0answers
37 views

Unity Height Field Fluids

I am trying to implement the fluid simulation in the slide deck found here in unity. http://matthias-mueller-fischer.ch/talks/GDC2008.pdf I was able to implement what is found on page number 2, the ...
0
votes
1answer
49 views

How to check a value from the last frame, while using events in Unity

What I am trying to do is check if a value has changed from the last frame, while using events. Typically I could use threading to my advantage and have a check at the bottom of Update() to see if a ...
0
votes
0answers
33 views

Farseer physics engine: save world simulation and load at a later time

I have created a windows desktop game using monogame and the Farseer Physics engine (FPE 3.5). In this game I would like to the user to be able to save the game and continue at a later time. When I ...
0
votes
0answers
3 views

How can I remove / delete a picturebox during runtime? C# Windows form [migrated]

I am coding a basic game. The player collects a gem by touching it; this adds +1 to his score. The gem is a picturebox, and I want to dispose of it once it is collected. As far as I know, this isn't ...
0
votes
1answer
80 views

Unity 4.6 UI Replace Images on selection in List of buttons[i]

I made a list containing all the buttons in the UISelectionCanvas and would like to change each image as it is being selected. The problem is once the selection selects a new type of unit it will ...
2
votes
0answers
48 views

Client-Server Game Communication (w/ Protobuf, Relevancy and Delta Compression)

So, I have reached another problem while trying to implement my client-server communication. From everything I've read there are three main ways to minimize packet size: Only send what has changed ...
0
votes
1answer
46 views

Add XNA math references to non-xna project

I'm developing some game with server/client structure, and the client will predict the movements, but it should be validated by the server. In the client part, I got it moving nice, but now I'm trying ...
0
votes
1answer
43 views

How can I load another form containing a new level when my player reaches the current level's exit?

I am coding a very basic side-scrolling game in C#, using Windows Forms. I want to connect my game's levels with 'exit points'. When the player touches an exit point, a new form should be loaded ...
0
votes
0answers
12 views

Separate each model part by “CRTL+MouseLeft”

I have a model,I want to separate each part of the model by using "CTRL+Mouseleft.I have done the part separation by clicking on each part.Now I need to separate each part by "CRTL+MouseLeft".How can ...
0
votes
1answer
27 views

How to rotate model 180º with XNA

I got a model, and a camera pointing at this model, I think my camera position is the problem. Its showing the front of the model, but I want it to show its back like in third person. My camera code ...
0
votes
1answer
72 views

How to make a model parts glow one after the another

I have a brain model. I want to glow the parts of the brain model one after the another after a period of time. I have done to glow the parts, but when the second part glows, the color of the first ...
0
votes
1answer
36 views

Accessing Canvas and Button components in a scene

I have a scene with the following hierarchy: This is game scene and the game manager is a singleton with the following variable fields: // canvas public Canvas PauseCanvas; public Canvas ...
1
vote
1answer
118 views

How can I merge multiple sprite into one sprite or texture using Unity3d?

I have an avatar generator where someone can create a custom avatar with layers superimposed. And in order to reuse this image multiple times, i want to merge all layers in one image. Is there any way ...
0
votes
1answer
58 views

Play continuous music when swapping between multiple scene in Unity3d

I have the following scenario Main menu scene containing a gameobject with an audio source component An about us scene gameObject script : using UnityEngine; using System.Collections; public ...
1
vote
1answer
63 views

Changing color of UI Text in Unity into custom values

There are a few objects in the scene as well as a title. I want the title to change its text and color based on the object that is mouse-overed. The script below is added to each object that is ...
2
votes
3answers
147 views

2D Smooth Tile Lighting

I am currently working on a 2d platformer and have the general idea of how to apply 'lighting' to my level, but I am not sure at all how to make it smooth, similar to Terraria, as you can see here. ...
0
votes
1answer
35 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 ...
0
votes
1answer
33 views

Array Rectangle Collision Handling Inconsistency XNA 4.0 [closed]

I made a simple collision detection prototype.Here's the code for the Player class's collision handler: public void handleCollision(GameObject OtherObject) { ...
1
vote
1answer
41 views

XNA texture garbage collection

I use a Dictionary<string, Texture2D> for storing textures and every texture in the game is a reference to a texture from this dictionary. However when all references are gone, does the ...
0
votes
1answer
45 views

Issue with fps limiting in XNA

The game I am making runs at 60 fps, but occasionally it will drop lower than that. I want to limit the frame-rate to 30 fps so that those drops will be less noticeable. I don't understand everything ...