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
1answer
26 views

Resources.Load doesn't grab values of my child class

I have a parent class Unit, and child classes melee unit/ranged unit. The parent class holds uninitialized fields such as health, damage, etc. the child class sets the values of these fields in an ...
2
votes
1answer
55 views

How to move on iTween path when a button is clicked

I have set the iTween path and also I have added a button. When I click on the button the object should start moving along the iTween path.But issue I'm facing is when I run my project at initial ...
1
vote
2answers
432 views

Create a continuous flight path on a Bezier Curve in Unity3d

I am working on a game in which a butterfly is flying along some path. What I am trying to do currently is create a Bezier curve starting from the butterfly's position(previous curves end point) and ...
0
votes
1answer
38 views

Touch taps only on very short flicks on Win7 with Monogame

I have an application on win7 which needs to support touch and mouse input using monogame. But reading touch taps proves to be a very hard thing. The TouchPanel is initialized like this: ...
0
votes
1answer
165 views

Getting Image name given a canvas WPF

I have a bunch of images I'm using for a chess game in a canvas using wpf, xaml, and C#. I want to use Canvas.SetTop(image, position); to set the position of this image. However I am given the ...
0
votes
1answer
50 views

Background Scrolling like Zelda - A Link To The Past with XNA [duplicate]

i am trying to create a background that scrolls like the one in zelda - a link to the past. in other words: i have a bigger "screen" than the camera covers, so i need to scroll over it, when moving. ...
1
vote
5answers
124 views

Advice on how to store level design info? [closed]

I'm building a 2D tile-based puzzle game in C#, using Monogame. The game board is an 8x6 grid of tiles, each of which can contain a number of objects. Conveniently, the number of possibilities for ...
1
vote
0answers
17 views

How do i change the vertical fit of a constant size fitter?

How do i change the vertical fit of a constant size fitter? For example changing vertical fit from min size to unconstrained. Is it posible to do this?
1
vote
1answer
22 views

Unity 5.x - Editor only constructor/initilization event

I have three scripts: Level - Represents a Tile Based level. LevelEditor - Custom Editor for Level. Tile - A non monobehaviour class for storing tile information. Level contains an array of Tiles ...
1
vote
1answer
22 views

Strange anomalies when using WinForms with XNA

I haven't seen any questions related to my issue, and this leads me to believe I'm missing something minor, however; The Problem I'm creating a game that is effectively launched from a windows form. ...
1
vote
1answer
105 views

How to change the transparency of an object in Unity c# scripting?

I have laser-object in my scene, which I want to be seen only when I press the 'E' button on the key board(just an example of a key). I have seen many ways to change the transparency , however, none ...
1
vote
4answers
61 views

Moving Object on One Axis

Hi Im trying to move some 3D text on one axis, but for some reason it moves on 2 with this code. Can someone explain why this is/ how to fix it? Maybe this is a simple solution but i cant find it. ...
1
vote
2answers
392 views

Control animation using animator control class

I did a sample existing code to control animation using animation.I dragged and dropped a character into the scene then I added a Animator to it and added the animator controller.Below I have given ...
0
votes
1answer
79 views

How to deal with a many to many relationship between objects

In my game, I keep a list of all clients currently connected to the server and a list of all actors in the game. Each actor is "relevant" ( currently replicating ) to 0 or many clients, and each ...
0
votes
4answers
158 views

Checking if object passed between two other objects

I have a three objects (strikers), lets say red, green and blue. When I apply force to the green object I want to check if it has passed between red and blue or not. See the image below for an ...
2
votes
3answers
34 views

Get OnMouseDown to work with a 2D Polygon Collider

I'm having a hell of time getting a 2D polygon collider to register a mouse click. I've attached images and code to show where I'm at. I cannot get the click to work. Ultimately, the thing I'm trying ...
0
votes
1answer
354 views

How to change the speed of the gameobject moving on the itween path

I have set an itween path for an object to move.And I have written the code as iTween.MoveTo(gameObject,iTween.Hash ("path",iTweenPath.GetPath("train"),"time",300)); The above code is working for ...
0
votes
1answer
70 views

Unity animation editor having trouble to animate twice the same component

I'm not getting warm with the Unity animation editor. This is what I want to do: The 2 lasers should be like this, rotating 360 degrees over and over. .The classname laser2 doesn't mean anything, I ...
2
votes
1answer
222 views

How to impale and stack targets correctly according to the collider and its coordinate?

I'm making another simple game, a catch game, where a spawning target game object must be captured using a skewer to impale it. Here how: At the start, the falling object (in red) will fall in a ...
2
votes
1answer
464 views

Why is OnCollisionEnter2D called when it's layer's collisions are being ignored?

I'm sure this is down to my lack of understanding of the unity physics system. I'm trying to implement a simple one-way platform for a 2d game and have got stuck on creating a reliable way to let the ...
0
votes
2answers
280 views

How to make legacy animations run in Unity in unscaled time? (Pause game related)

I'm relatively new to Unity, and I've been having a very difficult time getting the legacy animations to run in unscaled time. I need to pause my game, and as soon as it pauses, I need to have my ...
0
votes
1answer
18 views

Having trouble with a trigger zone. How do I make it so that it deletes certain objects, but ignores others?

I'm trying to setup a system where I pickup an object drop it into a zone, and then the object is destroyed. So far I have: using UnityEngine; using System.Collections; using UnityEngine.UI; ...
3
votes
1answer
2k views

How can I create or extrude a mesh along a spline?

Let's say, for example, that I have a working spline. I want to use this spline to create a mesh, but I'm not quite sure how to go about it. For example, I want to create a road along this spline. I ...
2
votes
2answers
58 views

Instantiation of a GameObject not working for a threading reason

I receive the following error "INTERNAL_CALL_Internal_InstantiateSingle can only be called from the main thread." "Constructors and field initializers will be executed from the loading ...
0
votes
1answer
37 views

Sound Effects on Monogame delay

I have recently added some Sound Effects to my game, but the problem that I am dealing with now, is that they have for a half of second delay, or more sometimes. Also, if I press repeatedly on that ...
0
votes
0answers
47 views

AssetBundle not working properly

I am using Unity 5.0.1. I have created the asset bundle of a sprite by selecting the name "img.unity3D" from the dropdown and then running the script : BuildPipeline.BuildAssetBundles ...
5
votes
3answers
204 views

3D Object not drawing in Monogame

I'm quite new to working with 3D objects. I'm currently trying to get one to load in Monogame. The object itself was imported into Blender and exported as an fbx file (which was the only file type I ...
0
votes
2answers
195 views

animation control problem

I have a list of .FBX object.When I drag that .FBX into scene its corresponding inspector Animation component(fig 1) appears but when I drag some other .FBX object into the scene the Animator ...
0
votes
0answers
25 views

Enlighten interfering with smartfox user objects

This code is checking if a userID matches any id in a SFSUser List: foreach(GameObject element in connectedPlayers){ if(element!=null) { ...
1
vote
2answers
80 views

How to check if grounded with rigidbody

Does anyone have a better way to make an object with a rigidbody check for ground and then jump, right now I wrote a script where a raycast is cast downwards and it checks for distance but then I ...
0
votes
1answer
35 views

UNET Error handling

I am trying to handle errors received by a UNET (new Unity3D networking) client. The below code successfully connects to a server when it is present, but obviously gives a timeout error when there is ...
0
votes
1answer
291 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 ...
0
votes
1answer
83 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 ...
1
vote
1answer
119 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 ...
1
vote
2answers
642 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 ...
2
votes
3answers
279 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
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 ...
0
votes
1answer
250 views

How to move rigidbody player to its facing direction with AddForce?

How can I move a rigidbody to its facing direction? I've already tried this: rigidbody.AddForce (transform.forward * v, ForceMode.Acceleration); // v is a public float which gets a new value in ...
0
votes
2answers
283 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
1answer
88 views

How to save the Mesh from an Interactive Cloth at runtime in Unity?

At the start of a scene I have GameObject called 'sheet' positioned above a 'ball' GameObject. The sheet has an Interactive Cloth component on it and a Cloth Renderer. The Mesh for the Interactive ...
0
votes
1answer
261 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 ...
1
vote
1answer
486 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
3k views

Can't play animation from script in unity

I'm making a 2D sidescrolling game in Unity, and when the player shoots an obstacle, I want the obstacle animation to play and then destroy itself. I got it to destroy itself, but the animation won't ...
0
votes
1answer
104 views

AABB collision resolution issues

I'm trying to make a character collide with some tiled terrain. I have an issue with the collision resolution, and after days of shooting in the dark ant not finding any relevant help online, I'm no ...
0
votes
2answers
2k 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
124 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
1answer
31 views

Instantiation of multiple objects with varying velocities

I am looking to multiple objects of the same prefab at the same time with varying velocities. public GameObject prefab; public float xDirection; public float yDirection; void Update () { ...
0
votes
3answers
66 views

2D Physics friction on a moving platform?

I have a few basic platforming mechanics going on in this scene. I have a prefab platform with an animation that loops back and forth between two different x positions, but does not begin looping ...
1
vote
1answer
96 views

Should frame update and network packet sending synchronous or asynchronous?

I am making a game server that has 60 Update-Per-Second (assume I can most of the time achieve it). In the current model, my main loop does the following tasks in sequence: Update game logic ...
0
votes
1answer
50 views

Unable to Set Text of another Text Object

The Idea: Pressing a button in the canvas will allow the player to select a race. A script is attached to an object which is accessed though the OnClick() function of the button. The script is ...