Quantcast
Browsing all 215 articles
Browse latest View live

Why does my variable show a rising score AND 0 at the same time?

I'm making a score counter and letting other objects access it with Get and Set functions. The Inc(n) function works and "score" keeps going up, but GetString() shows "score" at 0. Why is that...

View Article


How to get a value set by another script?

So basically I have a script attached to objects that when they are pressed on it deletes them and adds 1 to a GUItext counter. I'm doing this with var PageCount : GUIText; var Count : int; var Pickup...

View Article


PlayerPrefs - Sound slider values

I am currently working on a menu for my game, and the sound options screen works for the game, however I would like to have the sound values saved for the next time a player starts the game, instead of...

View Article

Getting parameter values sent to a method c sharp script

I want to retrieve the values sent to a method outside the invocation of the method, using this example public void myExample(int a, int b) {..} I could call with : myExample(10,20); Outside of the...

View Article

Remove object based on its position alone

Language = Javascript I have a number of terrain pieces tiled together. At some point I want the Destroy them with some script. But the terrain objects themselves are all clones. All I need is...

View Article


How do I set and get the position of a object?

How do I set and get the position of a object in vector 3 form? Edit: I am using C#

View Article

How to have a glow around my planet?

I have myself a nice Earth, but it is a bit of an eye-sore since there's no glow from an atmosphere. How do I get one?

View Article

Useless GUI problem again

Ok guys so i was thinking how to make an inventory with unity gui. So i thought to make buttons with textures for items icons and work on them. But i cant do even this... I have a gameobject array [20]...

View Article


Multiplayer - controls get switched

Hey there, I just got my Multiplayer game working, and I have a question, I guess the answer is very simple. When I start a multiplayer server, everything works fine, When another player joins, we have...

View Article


GetComponent

I need some help with this GetCompnent peice of code: if(hit.GameObject.tag == "Head") Enemy.GetComponent(dead) = true; I am afraid that I don't know anything about GetCompnent, and after a long time...

View Article

problem with get{} and set{}

I wrote some code like this and make it a prefab: class monster:monobehaviour{ private int _health; public int health { get{return _health;} set{_health = value;} } } the problem is : I can't find a...

View Article

get_compare ()(*previous, *i) error on start

I keep on getting a strange error every time I start unity with my project open. get_compare ()(*previous, *i) it's shown as an error, not a warning and yet my project is still able to be compiled. I'm...

View Article

What are these things doing in C#?

I'm switching to C# from unityscript and so far I'm enjoying the ride :) Can someone that knows c# well explain what these things are doing? 1: something = (float)sometingg; Why is "(type)" there? 2:...

View Article


How to get name of animation playing currently ?

How to get name of animation playing currently ? Im asking this for a 3d character model. and legacy animation system , not mecanim.

View Article

Find all gameObjects with same tag

Hello! I have a script that is suppossed to find all objects in the scene with the tag "Bar" and change a variable of the script that they have. But it doesn't work. Any help? var baricades =...

View Article


Get Value/String From GUIText

This is a really simple question but I cannot find an answer. I want to get a int value from a GUIText object and add a number onto it. There are three scripts all modifying a value so I want to get...

View Article

Overriding a function.

So I have a controller class which has a getter for the character's view. But I have a player subclass that should instead get the camera's view from the same function. Basically, I want to call...

View Article


how to get value from other script?

I have 2 Script : 1. EnemyAI [this C#] 2. EnemyHealt [this JavaScript] I want to get value CurrentHealt from EnemyHealt to EnemyAI. How to do that? NB: Sorry for my bad english.

View Article

C# Parent-SubClass set inherited properties help

So I'm struggling to grasp this whole get; set; properties thing. Specifically, public class Gun : MonoBehaviour { public string gunName { get; set; } //"BLANK"; public string UID { get; set; }...

View Article

Object Reference Required To Access A Non-Static Field

I Have Been Searching All Day, And Can Not Find Out How To Use A Object Reference. I Have Tried **public RoomGener Test = GameObject.Find("Script Holder").GetComponent();** And It Still Says I Cant...

View Article
Browsing all 215 articles
Browse latest View live