Quantcast
Channel: Questions in topic: "static variables"
Browsing all 84 articles
Browse latest View live
↧

object reference required to to access non-static member, userSession

I'm trying to get userSession, a variable to put in to my highscore database but i keep getting object reference error. My SessionScript get the user's name that is logged in from the User table...

View Article


Static variable resetting when it shouldn't!

Hi! I have a problem with just one of my static variables and I have no idea why. It was working correctly just a day ago and now it isn't. A certain trigger is supposed to give the player one point,...

View Article


A Question about static, please help me.

Hello everyone, when i am learning Scripting "static", there is a question wrap me around. 1. What is the different between: - public static float a; - static public float a; 2. if a public function...

View Article

Start behavior only working when one instance of UI in scene

Hi there, I know I'm doing something obviously wrong but I can't seem to find the right words to search for.....so apologies for the n00bism. I have a class with a simple start function that takes the...

View Article

Static variable inside a function like in C ?

In C lang I could do something like this: void f() { static int a = 0; printf("%d\n", a); a++; } Calling this function 3 times would result in: 0 1 2 Is it possible to use static variables like this in...

View Article


How to access static members in the watch/immediate window when debugging...

I have been searching for an answer to this for a while and a great one would be really appreciated. Let's take the following scenario: I am in MonoDevelop on OSX, I placed a breakpoint in a class and...

View Article

Force reset static variable

After googling a bit, I've tried some methods to try to reset a static variable, but none of them want to work (Sure I'm doing some wrong steps). First I tried to Reset the value to 0, both via Start,...

View Article

Environment reset after plugin import kill all static variables.

Hey I'm trying to realize installer with settings in Editor for my own plugin. It should ask user about required parts of my plugin, download some zip and unitypackage files and import them to a...

View Article


How to reset a static variables on loading a scene...

How to reset a static variables on loading a scene [SceneManager.LoadScene(NameofScene)]. I tried to initialize variables in Start function or in Awake function but i find bad result.

View Article


Sound Clip isn't playing when triggered.

I want my kill streak sound to be triggered when the KSsound value reaches 250. However the sound doesn't play when the value reaches 250. using System.Collections; using System.Collections.Generic;...

View Article

Does reading/changing Static variables constantly affect Performance or get...

From the last question that i asked, @Bunny83 said: > `GUI.enabled` is just a state stored in an internal field. There is no overhead involved setting that state. So `GUI.enabled` is a static bool,...

View Article

load winning scene when completed race

I got this script that goes along with a checkpoint script, it has a static variable that counts how many laps the player has completed, what I want to do is load a winning scene or overlay when the...

View Article

Static variables and Design Fundamentals (singleton)

So, I've been pondering this question for quite some time as I am a self taught developer, and outside the scope of scripting inside of Unity, my knowledge is pretty lackluster in terms of software...

View Article


Static Variables

At first, I have read all the static variables post on forum and questions. I am using 2 scripts - 1 that is Running and 1 that is Character Motion In the first script I have declared a static variable...

View Article

Using variables and classes of C# in Javascript?

Hello, I have a set of Javascript classes that each work on a number of static variables. The problem is that some of these static variables are obtained by calling a function which my friend...

View Article


Asign value of Attribute to static variable

Hi everybody, I'm attaching my Script "VisibilityScript" to some GameObjects with the following Editor-Script: class MyPostprocessor extends AssetPostprocessor { function...

View Article

What is the best way to implement Game States?

So I am trying to create an RPG, and off the top of my head I will need about 4 different game states that changes what button input does. The first would be the normal state (when your just walking...

View Article


Reset static variables

How can I reset a static variable? For my game i have a reset button however it does not reset my static variable. my static variable is: public static int Score = 0; and it is being called at: void...

View Article

Static Variable Doesn't Change ?

Hello Unity Community. I'm very anixous about a code :S There's a code i translate form C# to .js #pragma strict /////////////////////////////////////////////////////////// var startTime : float; var...

View Article

Static References to Game Objects: Bad Idea?

Hey guys, I'm relatively new to Unity, but I've been programming for some time now. Some friends and I are building a game and I had the idea of making a central manager that has references to certain...

View Article
Browsing all 84 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>