Get instance of exisiting object
I've looked for a while now, and I can't figure out how I can get an instance of an object (a c# object!, not unity gameObject!) from another script. As an example I have a class like this: public...
View Articlec# setter/getters
Hi I'm coming from a Java background. I cant find many resources on c# getters/setters in unity. I have prefabs with the Block script attached to each. Each prefab is loaded into the MyBlocks[] I just...
View ArticleGetComponent help needed CSharp
hey everyone, GetComponent is somethign that i never realy understud and have decided to use send message instead(i truely dont knwo which one is better tho i believe its the GetCOmponenet) and right...
View ArticleInput.GetButton vs Input.GetKey
I'm working on a tps with the traditional wasd movement and correcting the character rotation according to its direction relative to the camera (by pressing w you see the character's back while...
View ArticleGet when an enemy is killed
Hey, I am currently very new with Unity and Javascript/C#, but have some coding knowledge in LUA, so I know basic coding structure etc. Anyways, my question is, how would I go about getting when an...
View ArticleGetting the velocity direction as a euler angle.
Hello peoples, I need a way to get the direction than an object is travelling in, as a Euler angle. In fact it might be worth mentioning what I'm actually trying to do, just in case there is an easier...
View ArticleHow can I get Rigidbody.velocity instead of set it?
How can I GET the Rigidbody.velocity instead of set it? I am trying to make a rocket always face "forward" towards its velocity.
View ArticleCant Get Componet From Script
I am having a small issue using the componet command from my C## script, my current script is javascript and I want the script to add health by using this command inside of my "PlayerHealth.Cs" file....
View ArticleDoes GameObject.FindGameObjectsWithTag("Player") work using photon ?
I am making an AI using c# and photon for unity but it only chases the host and not players that join. Im using GameObject.FindGameObjectsWithTag("Player"); to find all the players in the server and...
View ArticleGetting Variables From An Arbitrary Component?
I am familiar with the basic way of getting components by ASpecificComponent aSpecificComponent = (ASpecificComponent)transform.GetComponent("ASpecificComponent"); aSpecificComponent.anInt = 0;...
View ArticleWhy wont this work? (I've done similar 1000 times fine)
I've done this get component stuff 1000 times and its worked just fine, but its been a while so I don't remember if this is right. I would like it to work without making a public variable for the...
View Articlewhen testing in the game mode , shots don't fire ?
iam following the official unity space shooter tutorials but in 2d space/orthographic setup and my player is just a 2d sprite/.png the shots fire only when i drag the shot prefab into heirarchy in game...
View ArticleCustom Header with WWW Get
I found a code example someone put up that said you can add a header to your Get request by leaving the postdata parameter null. What's happening to me is that when I include the headers I got a 404...
View ArticleHow to get an object with exact coordinates?
Hello everyone, my first Question I'm posting. Basically what I'm trying to accomplish is getting an object(collider object) using the exact coordinates given. What I've been hoping and trying to...
View ArticleIs there a way to get the symbolic String name [editing name] of a variable...
Hi UnityAnswers Community, I was wondering if there was a way in C# to get the symbolic name of a variable at runtime. I am saving to disk several properties of a Scene in the form of "STRING=value"...
View ArticleProblem with input code for a camera follow/rotate script
I am trying to make the camera follow the sphere, but let me pivot the camera around it. I have this script but when trying to set up the controls I am having an issue. The spherecontroller, and the...
View ArticleGet values from long string (C#)
Hi I am currently integrating the Facebook Unity SDK in my game and when I load an app request, I get this result from facebook: { "id": "453305136468701", "application": { "name": "TEST_APP",...
View ArticleInstead of "new" for accessing properties?
hey guys! so im pretty new to unity but i know a little bit about programming. so as the title says. im looking for an alternative way of access my properties. also im trying to figure out how i can...
View ArticleHow do you get child and grandchild?
I have a GameObject which contains children and grandchildren. I would like to change the layers of the entire Parent folder with another layer. Currently the parent and her children I was able to...
View ArticleHelp with static variables not being saved
I made a script where all my scripts are written, I access them periodically so I don't have to write the same script over and over. Now I have a problem when I set a variable and read it again its ok,...
View Article