C# is a multiparadigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.
-1
votes
0answers
22 views
Unity 3D - For i loop never ends [on hold]
When loading a save the spawnObjS function For i loop gets stuck and keeps repeating itself over and over again, das the gameobjects keep spawning again and again.
using UnityEngine;
using System....
-2
votes
1answer
35 views
Playerprefs dont work fine!
because it don't work fine! i am pretty sure there is no else problem.
also how can i remove playerprefs data in windows? i used Playerprefs.Deleteall(); but it also don't work.
is there any problem ...
2
votes
2answers
206 views
What is the class name in Unity's AddComponent?
Unity's AddComponent() method has an optional parameter of a string. This string is the className. What is the class name? What is it used for? I could not find any documentation on this.
-1
votes
0answers
13 views
WWWForm - .AddField vs .headers
I am using WWWForm to do the equivalent of GET and POST from python. To add headers to my unity requests, according to the documentation I could two options:
WWWForm form = new WWWForm ();
form....
0
votes
1answer
43 views
[Unity][C#] Coding Better Camera Recoil
I am trying to get a good camera recoil system in Unity, but what I have tried so far doesn't seem to look very good. My current method, is using Quaternion.Lerp. With the way I have my shooting ...
0
votes
2answers
38 views
Touch to continue (coroutine) in unity
When the object gets destroyed in my game, I want a touch to continue function after a delay. This is what I tried.
this is the SceneManager class which is attached to the Main Camera
public bool ...
0
votes
1answer
21 views
Unity: Read Text with RichText Tags from Textasset
I am rading a text to be displayed in a Text UI from an asset using the standard commands
Resources.Load<TextAsset>("nameOfMyTextAsset");
The text is a .txt.
The text contains richtext tags ...
-6
votes
0answers
52 views
Best Game Engine (2D, C#) [on hold]
Does anyone know a good 2D supported game engine for new folks like me? I don't want Unity of XNA.
Why I don't want Unity. Unity is more created for 3D games. Also, I don't know how to even set ...
0
votes
1answer
57 views
TileMap chunk generation
I have a class TileChunk which at it's most basic contains a rectangle that surrounds the chunk, and four bools isLeftLoaded, isTopLoaded, etc. Using the rectangle I can determine which chunk the ...
1
vote
1answer
51 views
How to track if an action is executing with IEnumerator and StartCoroutine
My code:
public class CharacterBehaviour: MonoBehaviour {
bool isExecuting=false;
Action action;
void Start{
action=new Action();
}
void Update{
//Other methods
if(!isExecuting)
{
StartCoroutine(...
0
votes
2answers
48 views
Unity WWW: Post a request to an URL with custom headers
I am using C# to try retrieve a token and my code is based on this example:https://docs.unity3d.com/ScriptReference/WWWForm-headers.html
IEnumerator Start() {
string urlToken = "myUrl";
WWWForm ...
0
votes
1answer
67 views
Handwriting or handwritten text recognition in augmented reality
Is there any way available to detect handwriting of a user using augmented reality within Unity. Or convert user hand written text into characters?
0
votes
0answers
46 views
MonoGame: 2D Sprite acting weirdly
I have a double array of tiles that show the ground.
They are randomly populated with a variety of items.
one item that only spawns one is a creature spawner.
this spawner spawns up to 5 creatures (...
0
votes
0answers
27 views
Unity3D Only render when key is pressed
I am researching Interaction Latency - the delay between pressing a key and seeing the result on screen.
I have my Unity3D application deployed remotely to an EC2 instance on AWS. I have another ...
0
votes
0answers
8 views
Script not properly respawning player after calling NetworkServer.Spawn(prefab) [on hold]
I have the following script:
public class RespawnScript : NetworkBehaviour {
public GameObject thingToSpawn;
void Start () {
StartCoroutine(Wait());
}
IEnumerator Wait()
...
1
vote
1answer
27 views
Unity C#: Using Linecast with collider bounds
I'm trying to to detect when two 3D objects overlap each other 'visually' without actually touching. For example, if I have two spheres in a scene that are 1 meter apart and I rotate my camera around ...
0
votes
1answer
63 views
Unity2D - How to leave and come back to the same scene properly?
I am new to game development and for exercise I made endless runner where everything is generated randomly from prefabs and both player and obstacles are being destroyed once they are off the screen. ...
0
votes
1answer
27 views
load scene - some time (2 seconds) after object is destroyed in Unity
How do I check if an object has been destroyed. And do something like change scenes 2 seconds later.
this is what I tried:
float delay = 2
void OnDestroy(){
delay-= Time.deltaTime;
if(delay<=...
0
votes
0answers
27 views
Vuforia is not rendering real world
I follow this guide (How-to-build-an-ar-android-app-with-vuforia-and-unity) but added my own mobile picture in database (as a marker) so that I could see animated object on my mobile and i am able to ...
1
vote
1answer
42 views
Twitter in Unity
I would like to talk to twitter through my unity game.
I found an library for .NET C# that could help, but I am not sure if this is the right way.... The repository for Tweetinvi is here: https://...
0
votes
1answer
66 views
How to Replace two object by rotating in center
I created Find Rock game but I have problem In replacing two object by rotating in center and when rotating finish stop rotating how can I do this?
using UnityEngine;
using System.Collections;
...
0
votes
0answers
28 views
Free OpenCV for Unity3d? [on hold]
I am willing to implement OpenCV in Unity3d and found this(OpenCV for Unity) and this (Emgu CV v3.x) at Asset Store but Unable to purchase it.
I googled but nothing found accept free EmguCV in C# but ...
0
votes
1answer
40 views
Getting an Object From a List (Unity C#)
So in Unity I'm making Snake, and to do that I've a list which houses all the tail elements from the Snake (this was implemented by the NoobTuts tutorial on snake just FYI).
I'm find with adding ...
-1
votes
0answers
46 views
How to make characters line up in front of a kiosk at Unity?
In my project I have a queue struct which contains character models. I need to make them line up. When the first model on the line leaves it, the one behind it must take his place and all the line ...
0
votes
0answers
22 views
problems in make local offline game in unity
I'm new to unity and now I'm learning how to make local game (offline with wifi).
so this is my code:
using UnityEngine;
using System.Collections;
public class s2sc : MonoBehaviour {
...
0
votes
1answer
44 views
Unity Editor: Get Mouse coordinates on left click on Scene Editor
I need a simple script which does the following:
When I left-click somewhere in the Editor-Scene:
(doesnt matter if there is an object under the cursor- or not)
Do NOT deselect the current ...
2
votes
1answer
113 views
How to create “broken glass” animation?
I have started making a 3D game in Unity5 that consists in avoiding obstacles. It is very easy but I want to add a collision effect when I collide on the wall.
I would like to slice the screen into ...
2
votes
1answer
35 views
Keeping a object(world space canvas) always in the cameras viewport
So I have the following problem: I have a world space canvas following a arrow that moves around the screen. The canvas itself is just a child of the arrow. The problem is that sometimes when the ...
1
vote
0answers
33 views
C# drag and drop user control to another cell in TableLayoutPanel (WIndows Forms)
I am trying to make a Chess game in C# using Windows Forms. I made two user controls; one for the chess board and one for a chess piece. The Chess board has a Panel and a TableLayoutPanel (called ...
0
votes
2answers
56 views
UNITY 3D - Saving last scene
I can't find working solution for this problem anywhere. Here is what I'm trying to do:
My Android game contains 10+ levels, user quits game on level 2. Next time user starts game it load level 2 ...
0
votes
0answers
28 views
WebcamTexure looks really distorted
I am trying to have an open camera view behind the canvas of my game. I am using a cube and I attached a script to it that uses a WebCamTexture to put the camera texture on the cube. When I test the ...
0
votes
0answers
28 views
Develop a map in Xamarin
Do I need a game engine to create a map like Travian map in Xamarin?
If not can I create it with Xamarin Forms?
2
votes
1answer
114 views
Draw circle around gameobject to indicate radius
I have a tower in my tower defense game im making with an upgradable radius and i would like when the user clicks the tower to show the radius as a circle around the tower
My original thought was to ...
1
vote
0answers
26 views
Naive Surface Nets - Translating from Javascript to C# Issues [closed]
I've been attempting to convert this Javascript code into a C# (Unity3d) script. It is an implementation of Naive Surface Nets explained here if that helps.
My translated C# script does compile ...
1
vote
1answer
44 views
Three button combination to open next scene
I have thirty (30) buttons in a trivia game, they are laid out in the following configuration with three rows:
( A, B, C, D, E, F, G, H, I, J)
( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
(00,01,02,03,04,05,06,07,...
0
votes
1answer
29 views
Collision from the underside of a cylinder (Unity C#)
A quick introduction to my problem at the moment: I am currently having trouble with checking whether or not a cylinder is grounded. I am using a mesh collider (octagonal prism) as my main collider ...
0
votes
0answers
31 views
Time-based events in Unity
I want to do stuff based on some time (I have a list of events and a corresponding Unix timestamp). The frequency of events in time varies and I want to capture that in a efficient and not to ...
1
vote
1answer
47 views
How to load values into a script from a file?
I have a prefab of a "generic unit;" each one has a script with some public variables: name, health, and attack.
Currently, I am manually making copies of that prefab and editing their names, health ...
2
votes
1answer
70 views
How to make enemies randomly choose a path and then come back if wrong one?
So I'm making a 2D Tower Defense-game in Unity with C# where the enemy has to go to the base, but can go to the wrong path randomly and then turns around when the road ends. How can I achieve this?
0
votes
1answer
31 views
Unity2D - How to destroy my Instantiate particle system
I'm having trouble trying to destroy my Instantiated particle system, I can only destroy my gameobject
using UnityEngine;
using System.Collections;
public class meteor_destruction : MonoBehaviour {
...
0
votes
2answers
67 views
Why does accessing ParticleSystem.IsAlive() raise this error?
I am trying to record if my particle system IsAlive with:
GameObject prefab = Instantiate (Prefab, myPosition, Quaternion.identity) as GameObject;
Component ps = prefab.GetComponent<...
0
votes
1answer
38 views
Why object spawn duplicate and double sides.?
I have a script, I am using this script to instantiate new path and also wall (as border) to generate new path and wall. Before some time all scripts work fine. but at this time my player enter in ...
-1
votes
0answers
23 views
How to use OpenCV/EmguCV with Unity3d
I am beginners to OpenCV and want to use with Unity3d. I found different costly packages at asset store but i can't use it i.e., I want to try it myself and found EmguCV that provide openCV wrapper in ...
0
votes
1answer
38 views
Unity detecting edge of mesh or end of mesh
I'm trying to create procedurally generated tiles and I've reached a point where I need to figure out the boundaries of the mesh or the outer vertices of the mesh.
RaycastHit hit;
if (...
1
vote
1answer
34 views
Unity - How to serialize / show private fields and custom types in Inspector?
By default, Unity only serializes public fields. How can I serialize private fields and custom types to show them in inspector?
-1
votes
1answer
26 views
Unity: Build on specific wall of the box
I'm trying to program game similar to Minecraft - you build environment from cubes. So far I found that Unity has a function which tells if mouse is over a box collider. I need a function which will ...
1
vote
1answer
57 views
Swipe Detection with mouse in Unity
This is my swipe detection code. This code uses touch input. I want to do this using the left mouse button. So basically I want to 'swipe' using the mouse.How can I achieve that?
public float maxTime;...
2
votes
0answers
44 views
How to disable and enable a randomly generated prefab in an endless runner 3d
Hi all I have been experimenting the endless runner game for some time and needed to optimize it. I read some articles about optimizing my game and it says that once you instantiate the prefabs in the ...
1
vote
2answers
34 views
GetComponentsInChildren<GUIText>().text - does not contain a definition
My Slider GameObject has a GUIText child. I am writing a C# script that should change the text component in the GUIText, but instead of this I am getting:
error CS1061: Type UnityEngine.GUIText[]' ...
-3
votes
3answers
62 views
How to make an OnCollision reset level script?
I am making a game and I want to make a script that if a player collides with the resetting object the scene will reset/reload.