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

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


Design Advice: Power Up System (static variables?)

hey there, I have a game in progress in which the player can fly around in 3d space and shoot weapons. I have various variables for the player like: movement speed, rate of fire, damage, hit points...

View Article


Static variables not staying

I'm creating a script so a player knows when they collect 5 coins in a row. For some reason, if there is too much time between coin collection Unity resets my variable back to 0...and I'm not sure what...

View Article

How to reset all static variables.

Hi, I have hundreds of static variables across dozens of scripts. In fact 1 script has almost 200 in, and there are 71 scripts. I am looking for a simple bug free way to reset all of these static...

View Article

Why are my static member variables null inside other classes/scripts?

In my application, there is a need for all of my strings to be multilingual. My first plan was to import key-value pairs as text assets and parse these per individual scene. Being rather new to Unity,...

View Article

how to keep static variables or 2d array value

I made a tilemap editor. Tilemap editor can make or edit 2d tiled terrain to use static values and 2d array. 2d array have terrain data. But when i play my game in unity editor, or updating my scene...

View Article


Multiple GameObjects accessing the same script, when script destroys game...

I'm making a shield system for the enemy ships. I have all of the shields running off of the same shield script, which seems to work fine other than when it destroys the game object. All of the ships...

View Article

Making my variable global.

I was trying to change the sprite image of my character from another scene. I made two scripts 1. Sprite_Img.js 2. changeTheSprite.js I have attached Sprite_Img.js to my character object and...

View Article


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
Browsing all 84 articles
Browse latest View live


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