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
3 views

Rotate player smoothly along the axis it is moving using rigidbody

I've been looking through tons of questions like this but I can't find anything that will help me with this. I'm using a rigidbody to move the player around and that works okay. But now I'm trying to ...
0
votes
0answers
30 views

TopDown Island Generation

I am trying to generate an island using Simplex Noise. To actually make a island shape i used Amitp's answers to the following questions: 1.Fast, simple procedural 2d island generation 2.Generating ...
1
vote
1answer
30 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 ?
-3
votes
0answers
60 views

Unity - C# How to create very Big Number?

public static float a = 9999999999999999999; This is the biggest variable that can create. but is not enough for me I need to get to this public static float a = ...
0
votes
1answer
23 views

Unity 5 Client RPC call: Failed to Invoke ClientRpc

I have a Unity 5 client and server running. On the server a path is generated and I want the client to receive the position of each target node on this path. Following the Client RPC calls section ...
0
votes
1answer
12 views

Audio slider doesn't change value

For some reason, my slider and audio resets back to 0 when I stop and play the game after I changed the value. Here is the code, I can't spot anything wrong with it: using UnityEngine; using ...
0
votes
1answer
32 views

Gravity not being applied to character, using character controller

So I just copy and pasted the unity example class to use with my character controller. public float speed = 6.0F; public float jumpSpeed = 8.0F; public float gravity = 20.0F; private Vector3 ...
0
votes
0answers
21 views

How to programmatically change sprite sheet sub-sprite name

I am trying to change the name of the sub-sprites of a sprite sheet. I have searched and tried everything I can think of and cannot get it to work, which makes me think it can't be done at this point ...
1
vote
0answers
61 views

Unity (C#): How can I create dialogue to be used in my game? (also critique my system?)

I've created my own system for handling dialogue. There's a class for each 'node' or part of dialogue. It contains the following variables: identifier (identifiers are unique for each NPC, but not ...
1
vote
1answer
17 views

Adding shadow and other effects on a spritefont Monogame

Is there a way that I can add shadow effect on text drawn in monogame? Because you cannot add shadow effect when creating a new spritefont file in Monogame Content Pipeline. Thanks.
0
votes
1answer
37 views

Monogame / XNA - Multple 2D Cameras (Rectangle) on screen

I recently started building a simple 2D roguelike game using Monogame 3.4. I was keen on building the game "engine" myself as I saw it as a fun learning curve. Monogame was pretty much the best option ...
0
votes
0answers
20 views

Rotation before scaling image/Lower resolution rotation? (XNA/C#)

Currently, when I rotate the image using SpriteBatch.Draw() the image is rotated after it is scaled. Resulting in: Which is using the code public override void Draw(GameTime gameTime) { ...
0
votes
0answers
13 views

SerializedPropertyBindings NullReferenceException

Using: Unity 4.6.1 Pro Visual Studio 2013 Pro, c# Team Foundation Connected to git vc Windows 7 Premium Building 2D iOS app (2D set up) Details: Periodically, this error is occurring. There ...
0
votes
0answers
56 views

Tutorial System in Unity C#

I am having trouble creating a tutorial level for my game in Unity. The first problem is efficiency. I have a script below, which displays the dialogue. And I want to know the best way to create goals ...
0
votes
1answer
24 views

How do I make one ui slider control all of the game audio?

I use the ui slider to control how loud is the game, what I want to know is how to make one ui slider control all of the game audio?
0
votes
1answer
46 views

Circle Depth Penetration

I'm resolving some collision between circles and I keep getting this problem. Note: The rectangles are perfect squares fitting the circles so when I type rect.Width I mean the radius of the circle. ...
0
votes
1answer
19 views

How do I use playerprefs to make ui slider keep the sound settings?

I have not use playerprefs before, I want to know how to keep the change of the audio when the player change it throughout the game.
1
vote
1answer
22 views

Function messages wont send when identical conditions will message to activate another function

So in working with my game, there aren't any syntax or compile errors, but there's this one bug that I've been working on to fix for a few days on and off and I can't seem to make heads or tails of ...
1
vote
3answers
62 views

In Unity, how do I make separate mute buttons for sound-effects and music?

I'd like to have a button to mute game sounds and another to stop the game music. How can I do this?
1
vote
2answers
41 views

Best practice for scrollable viewport rendering

I am working on a tile based game that renders the playing surface in a viewport. I am struggling with getting my head around the mechanics and best practices of rendering a viewport, specifically a ...
0
votes
1answer
34 views

Enemy Follow Player Orthogonal Movement

I have a Enemy class that Seeks a player if he is in his field of view. Problem is i want the enemy only to move up/down/right/left, not like for example up and left at the same time (diagonal ...
1
vote
1answer
48 views

Generating mesh along path

I'm currently trying to generate a path along an array of points(Vector3) This is the result i'm currently getting The dark gray points are the given path The red points are the generated verticies ...
0
votes
1answer
42 views

Unity C# new Vector3 problem

I get an error every time I try making a line with "new Vector3". Example 1: private Vector3 playerPos = new Vector3 (0, .5, 0); gives the error: The best overload method match for ...
1
vote
3answers
91 views

Story game loop [on hold]

I have been playing story based games such as lifeline or choice of games. I was wondering what game loop best describes what's happening logically? As when mauling over it myself in my head I am ...
1
vote
1answer
37 views

Double Jump causing problems?

Here is my code. I have an empty Gameobject directly underneath the child with a small radius checking the ground every thing seems to be correctly covered, but for some reason the jumping mechanic is ...
2
votes
1answer
61 views

Problem with Rotation - C#/XNA

I have a projecile(Hook) and the tail of the projectile(yellow balls) TailProjectile class draws a ball at the exact position of the projectile(hook) and let it there until the projectile ends I'd ...
-1
votes
0answers
13 views

Adding Texture and Sound content to Monogame [closed]

I was working with XNA C# Programming for Windows games until XNA got discontinued. I then discovered Monogame which is close to XNA. The only problem I have is importing content to the game. Back ...
0
votes
0answers
93 views

How to make chunk creation faster? Or how can I deal with slow chunk creation? [closed]

I'm using C# and XNA and I am creating a voxel engine with "infinite" world. I read this: How can I optimise a Minecraft-esque voxel world? And I tried the following: Using "shifted values" for ...
0
votes
0answers
12 views

System.ComponentModel.Win32Exception Run-time Error [closed]

I have been working on a game where the Player has to go around the game screen collecting objects before the enemy collects them. After a while of playing, I seem to come across a warning that forces ...
2
votes
2answers
57 views

Unity2D: Rendering multiple sprites as a single one

I'm creating NPCs in Unity 2D using C#, and I have 16x16 sprites for body, helmet, clothes and weapon. All these have a tile set which has been split in unity. I'd like to be able to render one of ...
0
votes
2answers
70 views

WaitforSeconds() not working as it should

I searched for using WaitforSeconds and used as it was mentioned(using a return type of IEnumeration and using coroutines instead of update). but it did not work. Initially it showed Waitfor Seconds ...
0
votes
0answers
50 views

Using an object as a model to avoid too many parameters - XNA/C#

I have 3 classes(Skill,Projectile and Status),Skill has Projectile and Projectile has Status, all of them need to read information from a txt and to avoid open it everytime I want to create an object ...
0
votes
1answer
30 views

Is it possible to load asset bundle dependencies manually in Unity 5.0?

Is it possible to tell Unity to not load asset bundle dependencies automatically so they can be loaded manually. If so, how can this be done?
1
vote
1answer
84 views

Keyboard.GetState() only work first time, and Memory increase (not Disposing)

EDIT UPDATE 3 I been searching the web for a solution and found several people struggling with Memoryleak using MonoGame while trying to dispose objects. It could be the case that MonoGame should be ...
2
votes
1answer
67 views

Determine if AI can traverse a given spline

I have some AI Agents that I want to navigate along a spline. The agents have a speed and a maximum turning radius. For some splines the curvature is too tight for the AI agents to navigate around and ...
1
vote
1answer
43 views

How does Unity load asset bundle dependencies and how can they be accessed?

Loading assets from an asset bundle is done explicitly. You give the bundle the name of the asset to load, then it returns it( either now or later. ) However, loading dependencies is done completely ...
0
votes
1answer
22 views

An object reference is required to access non-static member UnityEngine.Material.GetTextureOffset(string)

I am watching a tutorial where it seem to work. But in my case, I am getting this error. I get it that non-static members have to have an object. But, I don't know much about how to fix this error. ...
0
votes
1answer
49 views

Restricting my horizontal slash attack

I've been working on making this slash attack for my character in the unity engine. The whole point to this script is to put the damage range in sync with the slashing animation. The slash is ...
3
votes
2answers
45 views

XNA/C# Convert polygons into tilemap

I'm currently working on my 2D survival game, where the world is infinite and generated by perlin noise. I wanted to also include biomes and this article interested me - ...
0
votes
0answers
10 views

How to parse animation data of a .x file in SlimDX

I have a managed Direct3D9 application that uses SlimDX. I need to implement a custom animation controller. I want to parse the .x file for animation data. The SlimDX.Direct3D9.XFile and ...
0
votes
1answer
50 views

Why isn't OnTriggerExit working?

I have a price of code that looks like this: void OnTriggerExit() { Debug.Log("Object leaved trigger"); } But when I move an object that is colliding with the trigger by script it doesn't print to ...
1
vote
2answers
59 views

How to freeze rotation with a Rigidbody 2D? [on hold]

So I am looking to freeze rotation in the Y axis on a Rigidbody 2D. I'm not sure how to set this in my code. This is what I have so far, can you point out my errors? public class PlayerMovement : ...
-1
votes
1answer
84 views

How to optimize my movement & collision code?

I am trying to implement movement & collision the simplest way possible. public void MovePlayer() { KeyboardState keyState = Keyboard.GetState(); Vector2 checkVec = ...
0
votes
1answer
53 views

Unity Transform.Position not returning expected position

So in my scene hierarchy, I have an object laid out like so; -Level1 --Level2 ---Level3 ----Level4 My script is attached to the Level1 object. When I try to find the transform.position of Level4 by ...
0
votes
1answer
36 views

Texture doesn't scale and repeat

I wrote the script for automatic repetition of texture background. To save it I typed Cmd+S. I dragged and dropped the script to Background in Hierarchy. When hit play button the texture doesn't scale ...
0
votes
1answer
49 views

How can I increase the speed and frequency of a spawn?

I'm using the official Unity tutorial for the Space Shooter game, and I'm at the part where the ability to spawn a set amount of hazards in a wave at a certain delay is introduced. I want to make it ...
-1
votes
1answer
49 views

Why is this unity camera moving in weird directions?

I have the following script public class CameraScript : MonoBehaviour { public bool AllowZoom; public float zoom; public float Speed; Transform board; void Start(){ ...
2
votes
0answers
55 views

Creating Scenes Programmatically From A Deployed Build in Unity

This is somewhat of an extension to this question: http://answers.unity3d.com/questions/513801/programatically-creating-entire-unity-games.html I have a client who would like to create an entire game ...
0
votes
1answer
34 views

Random Y Axis Movement Within Set Limits (C#)

I've searched everywhere for this answer but everything I find is in Javascript and a lot of it doesn't help/work in my situation since most of it is Vector3's and using each axis, and my game is 2D. ...
2
votes
1answer
116 views

Why will my server not execute a command sent by the client in Unity 5.1?

I'm working on a very simple/basic client-server networking program, the basis of a future game I hope to create. Now the client program/project DOES successfully connect with the 'server ...