Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c#]

C# is a multi-paradigm, managed, strongly typed, garbage-collected, programming language created by Microsoft in conjunction with the .NET platform.

0
votes
1answer
24 views

360 degree Shooting using Pythagoras problem Unity 2D C#

I have used pythagoras to give the bullet a velocity in the bullet class. Velocity is applied when Instantiated(); ...
0
votes
1answer
49 views

Unity Hit Collider GameObject is Null when Collider is Child (Line-of-Sight Detection Problem)

I'm creating line-of-sight code in Unity. It allows a radar to check whether it can see an object, or whether the object is behind an obstacle (a collider). Similarly to Unity's suggestion, I check ...
0
votes
4answers
131 views

c# pong game move paddle

I am making a pong game using gdi+ and c#. I am using the move variable to move my pong paddle but it does not work. I am thinking about nesting my methods. Is it possible to nest the Form1_Paint ...
0
votes
1answer
27 views

Orthographic Viewport whose bounds are equal to screen Window bounds?

Ive been rattling my head trying to figure out how to do this. I am not working on a 3D application so I did not expect to need to understand transforms, projections, or viewports. Essentially what I ...
0
votes
2answers
131 views

Is it possible to use a string somehow converted to match name of a bool?

I have a Json file holding data for my LineData type i created. ...
0
votes
1answer
26 views

Changing button position makes it move drastically

I have a button prefab that I'm instantiating like so: ...
1
vote
2answers
58 views

How to add global variables to a global list and then call the elements in a second scene in Unity, c#

I have the following problem with my app. I have a scene where the player is adding products with prices, by using strings. They are added to a Global Control file, which saves the data. Then, in this ...
1
vote
1answer
54 views

How to stop camera rotation after reaching a specific angle?

I have a camera in my scene that I want to rotate around the player. The rotation is done when the camera rotation state is at CameraRotation.Left or CameraRotation.Right and CameraRotation.None ...
0
votes
1answer
36 views

is it possible to use dynamic types in c# generic methods?

for example i need something like this: SQLITE._instance.ds.GetItems<armour>(); armour is a class. but i need to get type of object to send to it in order ...
0
votes
1answer
28 views

Unity game crashing when dialogue with NPC initiated [duplicate]

I have 3 NPCs in my "Game". When the player walks up to any of them, they're supposed to have their own dialogue; I've tested this, and they do. I tried to create a display that shows this dialogue ...
0
votes
1answer
138 views

Unity JSON parsing Array of Objects problem - error: JSON must represent an object type

I'm trying to use Json to hold game dialog in a text asset file. I've tried to make a barebones project to test this and it is failing with the Error Message: ArgumentException: JSON must represent an ...
1
vote
2answers
45 views

How to play and pause animation

I want to make play and pause buttons to play and pause sound and also I want it to play and pause animation ,how should I do that? ...
0
votes
1answer
22 views

How can I make that also the yradius values will change when the flag is true?

In this part when I'm changing the xradius slider it's also changing the yradius slider at the same time and same value. But I can't change the yradius when trying to change it's slider. I want to be ...
0
votes
1answer
26 views

Why when using Linerenderer it's drawing a line also in scene view?

I want to draw lines using the Linerenderer only in the game view window. I'm using Debug.DrawLine but only drawing Red lines but for some reason when the Linerenderer draw a line/s one of the ...
0
votes
1answer
21 views

Interact with inheriting class methods from “casted” base class (collisions, etc)

I want to implement a damage system that works across both living items (Entity) and environment items (Environment). The key ...
1
vote
1answer
18 views

3D Texture Only interpolates on Y-Axis

I'm having trouble wrapping my brain around what actually is the issue here, but the sampler I'm using in my volume renderer is only interpolating the 3D texture along the Y axis. I roughly followed (...
0
votes
1answer
22 views

Changing Hitbox from a single spritesheet

I have different animation in a single spritesheet. I wonder how do you guys assigning these hitboxes?
1
vote
4answers
120 views

How can I convert Physics2D.Raycast to Physics2D.BoxCast to yield the same results?

This question has been updated to better reflect my current issue, and some of the progress made while solving it. I've been working on a 2D character controller that uses raycasting to detect ...
1
vote
0answers
13 views

Attach a method to every GameObject or use a manager script [duplicate]

I'm new to Unity but not new to development so I'm wondering what the standard way of doing this in with Unity. In the scene from the start is an empty GameObject that has a script that contains all ...
0
votes
0answers
26 views

Render a basic Quad to screen?

I have been trying to accomplish this for quite some time with no success; I've looked at several relevant questions here on StackOverflow with no success; I've also followed 6 different tutorials ...
3
votes
1answer
101 views
1
vote
0answers
112 views

Setting adaptive icon for Android from script(C#)

Want to set adaptive icon for Android from script. I am using Unity example: https://docs.unity3d.com/ScriptReference/PlayerSettings.SetPlatformIcons.html so, what am I doing: ...
1
vote
1answer
21 views

Tiled tmx format into 3d Texture

I am thinking of making 3d games with 2d pixels feel. So far, i have been playing around in tiled and monogames. I learned some xml and managed to import and render tmx into my game. This is maybe a ...
0
votes
1answer
51 views

Rider Language level keeps resetting

We've started working with Unity 2018.3.0b11 recently, and this means we can now use newer C# features, which is amazing! However, every time I've restarted Rider, it starts complaining about any C# 7....
1
vote
0answers
21 views

How to implement a network proximity checker in Unity using LLAPI?

I'm trying to implement a network proximity checker using my own functions in Unity, using LLAPI. How can I implemnet a network proximity checker, with similar functionalities than the ones in the ...
1
vote
1answer
45 views

How would I swap a character when a player touches a collider?

I wrote a simple script to attempt to do this and I created an empty game object and applied the script to it and dragged both of my sprites into my script and I receive no errors but nothing happens ...
1
vote
0answers
36 views

how can this random scene code run well when it is reloaded?

I have a code for random scenes, the scenes that I have are 10 randomized scenes, but when I reload the scene there is only one scene. ...
1
vote
2answers
89 views

How to reset the score to 0 when reloading the game?

My scoring system uses DontDestroyOnLoad to persist between scenes: ...
0
votes
1answer
31 views

Unity FPS style turning

I have this code: ...
1
vote
1answer
36 views

Unity right mouse drag turn

How would I use my right mouse button to turn a player character in unity, while only turning in the direction and speed of the drag? Not sure if I'm meant to post this here or stackoverflow. EDIT: ...
0
votes
3answers
72 views

How to add collision to this script in Unity

I Want to be able to have collision were my player can't go through objects with colliders un Unity but I don't know how to make that happen, can you please help? ...
0
votes
1answer
28 views

Is it ok to return a call to itself inside a method that has a return type?

Hello all I am making a little blackjack game in Unity. Although these classes don't actually use Monobehaviour or anything just yet. I have this method and I'm not sure it will work like this or not....
0
votes
1answer
44 views

Enemy doesn't fire at player

My script looks pretty good but it says Target variable has not been assigned value. ...
0
votes
2answers
77 views

Fire at enemy script doesnt work [closed]

I need my enemies to fire at me. I have a script and I think all is correct. I couldnt figure out why it doesnt work? ...
1
vote
2answers
34 views

LOD culled gameobject still interacts with raycast

The camera is sort of top down and the player can move objects around, rotate them, delete them etc. I use a raycast to check what was hit when the player clicks. But some objects are culled by the ...
1
vote
0answers
69 views

Unity : How to detect if a UI button is pressed down?

I want a UI up arrow button to be able to detect if it is pressing down. It is a child of a canvas in a 3D scene. My target platform is webGL for both desktops and mobiles. I coded not only the ...
0
votes
1answer
38 views

Is any Update() called always first than any LateUpdate() from other scripts?

If a script is called at a specific moment in the script execution order, will every LateUpdate() functions from the rest of the objects work after that Update()? The documentation isn´t clear about ...
0
votes
2answers
47 views

How would I apply force to a bullet in 2D?

I wrote the code below in order to try to get a bullet to fire at a specific angle for my top-down shooter. However when I press space the bullet just spawns in front of the game object despite it ...
1
vote
2answers
57 views

Unity: how do I make an input only available to the code?

I have a simple function attached to a button. I then decided to change it by adding an input. The problem is that the function won’t run unless I specify the input in Unity via the inspector. I don’t ...
-1
votes
2answers
53 views

UNITY || How to access the “exit transitions” of the current played clip from the animator?

So, I have an animator , i can access it. But from there I have no idea how to access the clips inside. I need to access the transition of the clips. I got as far as accessing the object of the "...
2
votes
2answers
145 views

Structuring game narrative. Handling NPC, Quest, General Dialogue. Is Json/XML the right way to go? Or any other solutions?

Hello guys I'm try to make some games that have more to it than just simple high score scrolling shooters etc. I'm trying to design my own systm of handling narrative. I want to be able to place NPC'...
0
votes
1answer
14 views

Get the mesh Project Plane on Click and calculate its area

Here is the excerpt of my script which is calculating the surface area and face area of a mesh on OnMouseDown Event. ...
0
votes
2answers
48 views

How To Destroy/Deactivate one enemy without affecting other enemies of the same type?

In my game, you jump on zombies'heads to squash them. Currently I'm only able to have one zombie in my game. When I add another (duplicate or drag from prefab), then run the game, I can squash one ...
0
votes
0answers
18 views

Google Protocol Buffers 3 Builders in C#

I am developing a game in unity3d. I am using google's protocol buffer 3.6.1 compiler to compile .proto files in c# but its not creating its builders. does builders removed ? whats the new way to ...
0
votes
1answer
172 views

How to check for mesh overlap?

I'm creating a level editor in Unity. I need to detect when an object is intersecting another as I don't want to allow the user to place an object when it is colliding with something else. In the ...
0
votes
1answer
24 views

Object activate it self without script order?

I have strange thing here in my script. In this script clock_time turn active lamp object one by one. Where Lamp object turn off after 3 seconds be anther script. If clock time reach 120 or higher ...
0
votes
0answers
10 views

Smoothing noises with different amplitudes (Part 2)

Well, I'm continuing this question without answer (Smoothing random noises with different amplitudes) and I have another question. I have opted to use the contour/shadow of a shape (https://...
0
votes
1answer
39 views

How to stop all character movement when jumping against the side of a platform?

My Sprite is Moving against a platform. I have a script and an unusual one (that's what one of the member said.) My isGrounded isn't using any rayCasting. I didn't have any problem with it but when I ...
0
votes
1answer
27 views

GameObject.FindWithTag throwing weird errors

I've got 2 first person controller scripts, one that handles functionality for basic movement, the other handling looking around. I also have a "CursorLockManager" script, that handles the cursor ...
0
votes
1answer
276 views

How to calculate the surface area of a mesh

I am looking for a way to calculate surface area of a 3D mesh object and found this code from a Unity forum: ...