0
votes
0answers
17 views

Add terrain collision and fix axis of camera

I made 3rd person camera script which works ok but needs few tweaks which I don't know how to fix. I'm using controller/ joystick. -Firstly, camera has this issue: when I look at the back of the ...
1
vote
2answers
79 views

Unity - OnDestroy - When is it called?

I was wondering about the method called OnDestroy in Unity (4.5.2f1) on Windows 8.1 Update 1. I know garbage collection in C# in non-deterministic, so I was wondering if game objects had OnDestroy ...
1
vote
1answer
68 views

Sever Structure for a Turn Based Game (Chess)

I am working on a Turn-based Game (Chess) I have done the client part and single player mode so AI is no problem here. But the only problem is now I want to make my project multiplayer. I have done ...
0
votes
1answer
34 views

Can't consistently add to TimeSpan for Unity Game

I'm making a game that has a timer showing how long the player has survived from being crushed by pessimism. (Long story) I'm trying to use TimeSpan in Unity to accomplish this but it seems that I'm ...
-1
votes
1answer
27 views

Object reference not set to instance of an object Unity3D c#

public class player { public projectile pro; pro = GetComponent<projectile>(); void Update() { GameObject go = GameObject.Find("enemy"); Transform ...
0
votes
0answers
34 views

How to create normal map from bump map in runtime?

I am using this port of libnoise to generate noise. There are several methods (Noise2D.cs, 462 and 494 line) to output images. Second one, that should give me normal map does not work completely, it ...
0
votes
1answer
30 views

Getting Target position at the time of shooting

I have a bullet that has to hit a constantly moving enemy. So, in BulletScript, I have declared a Transform public Transform enemy; //and assigned enemy object to it that is ...
-1
votes
1answer
63 views

How are grids made?

I've been looking at tutorials and researching forums and such but I still can't understand how the grids are made. I get confused at parts like this. for (int x = 0; x < Size.x; x++) { for ...
-1
votes
0answers
19 views

how to make unity3D client handle network message more effectly?

Recently I am working on a Unity3D client program. It will recevie message from game server. I use TCPClient to receive the message aync and store it to a locked queue. As u know, the client must read ...
0
votes
1answer
23 views

GUI Label shows on screen when object is out of view?

I have GUI Labels over NPCs in my game, and the labels display their name above their head. But when I walk away and go somewhere else, their names stay on screen like it's mirrored or something? ...
0
votes
1answer
102 views

Automatic Movement

I am making my very first GAME in Unity 2d. At the moment my game consists of 2 walls a floor, a ceiling, and a square which represents the character. After watching some tutorials I have created a C# ...
0
votes
0answers
18 views

Access public field of other module in unity [migrated]

I'm trying to read a field from another class library(mod) for Kerbal Space Program. I cannot directly access the field since the compiler is not aware of it and it is of a different namespace. ...
1
vote
1answer
105 views

Automatic Left/Right movement

First 2d game in Unity. Started Character controller in C#. Tried to get the character to move constantly right then once it hits the wall move left without needing any input from the player. Looked ...
1
vote
2answers
96 views

Simple square hit the wall and turn around without stopping

I am coding and making my very first plat former game in Unity 4.5 2D. Basically I want my character to ping pong between two walls. I have set up a GroundCheck and CeilingCheck. I was thinking to ...
0
votes
1answer
67 views

Binary Serialization of C# for GameObject in Unity?

I'm trying to serialize a GameObject (with children and textures) using the binary serialization for C#. It works with many data types but not with GameObject. In the docs it says should be ...
1
vote
1answer
43 views

Listen for asset modification in editor

I would like to listen for an event that some asset (prefab, precisely) has been modified. To my surprise, there's no such event in AssetModificationProcessor. Is there any way to do this in Unity?
2
votes
1answer
42 views

change texture at runtime

How can I change the texture at runtime. I have done changing the label(text) at runtime. The following code is used using UnityEngine; using System.Collections; public class switchtime : ...
0
votes
2answers
69 views

Drag an object in unity3d

I want to drag an object to a perticular place.In case I release that dragged object before I reach that particular area ,the object should come to its initial place where i start to drag. How it ...
0
votes
4answers
129 views

Timing of coroutines in Unity is never precise

I was looking an official example for coroutines in Unity here. However, when I call WaitAndPrint the time taken is never exactly 5 seconds. IEnumerator WaitAndPrint() { float timeStart = ...
1
vote
1answer
142 views

Fast, simple procedural 2d island generation

I need to generate tile data for an island based rpg, my goal is have something that looks like this (mountains not required): For the past few days I have been trying to figure out a satisfactory ...
0
votes
1answer
37 views

Changing the object material without clicking on it

How can I change the object material automatically without clicking on it? The object material should change based on a timer.
0
votes
1answer
51 views

Changing the material on an object on click in unity

Iam working on unity2d.I have six game object Object1,Object1,Object1,(these are images) ObjectImage1,ObjectImage2,ObjectImage3(these are images). I have arranged the object in the scene as a list ...
0
votes
1answer
41 views

Continous collision happening in Unity2d

I am working on Unity2d. I have a game object called gameobject1 on screen. It holds an image (named "state"). When I drag a tree on a gameobject1 collision is happening continuosly in the same layer ...
0
votes
0answers
34 views

Change the object when the object is clicked [duplicate]

In the above image, there are different icons for New, Open, Save, Save As and alternative images for when you click the icon. I have placed these images onto game objects. In the above menu when I ...
-1
votes
0answers
37 views

Changing the object when mouse is clicked on it

I have three object, in each object I have placed an image of a text. And I have another three images as same as that text but its is highlighted with the blue color. The first image is highlighted ...
0
votes
1answer
36 views

Generating a particle effect on top of a GUIElement (Unity)

I am working in Unity on a 2D project which is using C#. I have a number of guitextures which are hearts in order to create a sort of life meter. I would like when the player loses a heart for the ...
0
votes
1answer
30 views

Bounds Queries for Simplex Noise Function

How do I construct a Bounds Query for 3D Simplex Noise? [This is more or less a follow-up to my last question] Simply put, for an arbitrary octree node (cube) in my volume (a section of Unity3d ...
7
votes
5answers
2k views

Is C# different in Unity?

Does Unity use a different version of C#, or is it all the same? It looks different from regular C# but there are some regular C# elements in there.
0
votes
2answers
140 views

How do I create a knockback-movement?

I am a web developer new to game development, and with limited math knowledge. I am writing a character movement controller in Unity. The game has an isometric Diablo-like camera. The character moves ...
0
votes
2answers
79 views

Make a square flickering at a preset frequency

I'm working on a medi-sci project where I want the patient to use brainwaves to exercise control the environment. The environmnet is a 2D game where the game character is to be controlled by 2 ...
0
votes
1answer
80 views

How should I detect collisions with objects on a “timeline”?

I'd like to replicate this game's mechanic of the player smashing walls with a precise timing to a background rhythm. How should I check when each wall should be broken? Does the player animation use ...
3
votes
5answers
168 views

Can I extract Flash SWF sprite frames to bitmaps?

I want to create the 2D graphics of my game in Flash Studio, but then get all the frames from my SWF movies into C# for further work in Unity3D. I find it easier to create nice smooth animations in ...
0
votes
1answer
101 views

Angled topdown perspective camera for 2.5d game

I have a 2d tile based game created using Unity's 2d tools and orthographic camera: The tiles are created by programmatically generating a mesh, assigning a texture to each pair of triangles, and ...
2
votes
1answer
36 views

Unity refuses to open 2 popup windows

So am am making a unity program, where if you click 2 different objects, 2 different windows are supposed to pop up. To make them, I use private private bool showPopUp = false; private Rect ...
0
votes
0answers
46 views

how to add a spotlight effect to my targetenemy code

The current targeting code below changes the color of the enemy with tab button: Target enemy = change color of enemy to 'green' Deselect enemy = change color of enemy to 'blue' (press tab again) ...
-1
votes
0answers
27 views

Unity 3d: the difference developping in javascript/C#? [duplicate]

What is the difference(strong or weak)? I have asked several programmers, but they told me there is a preference topic.
2
votes
1answer
66 views

How to subscribe to an event fired from any Instance/Object of type X

I'm currently working on a small game-engine and i'm kinda stuck on finding the right pattern to subscribe to an event fired from any instance of type X.To understand what i'm trying to achieve, here ...
1
vote
1answer
90 views

Trigger for Melee-attack not working

I'm currently trying to add a melee-slash attack to my Sidescroller. For that I decided to to have an invisible box-colliders infront of my character. My idea is to activate it when the attack-key is ...
1
vote
0answers
79 views

How do I save a screenshot and load it as a texture for use in game?

I have a Unity level that takes a screenshot taken in the previous level and applies it as a material to a Plane, the problem is that it will get stuck and not apply the most recent version of the ...
0
votes
2answers
59 views

Load Prefab to variable

I have my code, for my weapon: using UnityEngine; using System.Collections; public class Arma : MonoBehaviour { public static int municao; GameObject bullet; GUIText texto; // Use ...
-2
votes
2answers
68 views

C#Script select GameObject

I want to load the prefab instead of the gameobject that is in the screen, my code is this one: using UnityEngine; using System.Collections; public class Arma : MonoBehaviour { public static int ...
0
votes
0answers
30 views

Unity3D : Prefab Instancing Issue

I am using latest unity engine and I am having a scripting issue. I create a prefab , added a few scripts to it and I am trying to instantiate a few of those objects like this : GameObject ...
0
votes
1answer
34 views

touch in guiTexture

Before time in my game start. i want there will show a guiTexture.. if i touch this guiTexture, that will hidden and the time game will start. I try to make a script but it doesn't work. I'm a bit ...
0
votes
0answers
41 views

hide and show many guiTexture

in the 1 scene there are many guiTexture. So how to write this code ? public class guiTanya : MonoBehaviour { public GUITexture guiA, guiB, guiC, guiD, guiE, guiF; void onMouseDown() { //if i press ...
0
votes
2answers
137 views

Problem with moving player through a secript by a set distance

I am currently trying to add a sort of "dash"-ability to my sidescroller. What I try to do, is to let the player press a key where a simple key-press causes the player to move quickly into one ...
0
votes
1answer
117 views

Unity Gui from text file templates

I've been banging my head against a wall this past while over how I might create menu's and menu components in unity from text file. I would normally just build my own extended panel/label classes etc ...
1
vote
1answer
131 views

How to compress Unity apk output?

I made a game with Unity but the size of .apk file got so large, it is about 70mb... Is there some way that I can compress my apk file?
0
votes
1answer
72 views

Make GuiText responsive

I'm using C# code to make a responsive GuiText. I was abel to make a responsive GuiTexture, but I'm struggling with doing the same for a GuiText. Code for the responsive GuiTexture using ...
3
votes
2answers
114 views

GameObject once walked on, gives message using C#?

I'm struggling to figure this code out by myself. I'm able to check if the objects are in the scene, and if they are print a message. I now want the GameObject of tag Zone to display a message to let ...
0
votes
1answer
43 views

Is it ok to destroy mesh directly from MeshFilter in Unity?

Mesh.Destroy(myGameObject.GetComponent<MeshFilter>()); May it cause any problems or undefined behaviour? (the reason I ask this is that I'm trying to destroy an exiting component which is ...