Quantcast
Channel: Answers by "Kleptomaniac"
Browsing latest articles
Browse All 90 View Live

Answer by Kleptomaniac

Yes, that is because it is a component of your camera and is only rendered while your camera is active in game. Within your scene, you are using your scene camera. That is normal behaviour. If you'd...

View Article



Answer by Kleptomaniac

As long as when you build your game, in the Platform Settings, you use 'PC and Mac Standalone', then your game will be compatible with both Mac and Windows. Unity does everything for you. :) For more...

View Article

Answer by Kleptomaniac

As is said [here][1], it isn't possible to set the cursor position without external .dlls. Screen.lockCursor doesn't automatically set the position of the cursor to the centre of the screen, it only...

View Article

Answer by Kleptomaniac

I would suggest cleaning this up. As @IgnoranceIsBliss said, strings can already be accessed as arrays. Therefore you can eliminate your SplitString function. Also, I'm assuming that underScore is the...

View Article

Answer by Kleptomaniac

To determine the direction that your character is facing, try [Transform.forward][1]. To rotate an object based on the position of another gameObject, try [Transform.LookAt][2] like so:...

View Article


Answer by Kleptomaniac

Have you tried enabling your Box Collider and Rigidbody when escape is first pressed and then disabling when pressed again? Since enabling and disabling these two components is not possible there are...

View Article

Answer by Kleptomaniac

Well, that totally depends on what current health system you have! But generally, assuming you already do have some manner of health system set up, the C# method is pretty much exactly the same as the...

View Article

Answer by Kleptomaniac

Just use a raycast from your cursor coordinates. Like so: void Update () { if(Input.GetButtonDown("Fire1")) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit;...

View Article


Answer by Kleptomaniac

I believe you could try using a switch-case method for this (never worked with switch-cases before though so we shall see how I go): void Update () { switch (yourRandomVar) { case 0: yourRandomVar =...

View Article


Answer by Kleptomaniac

Yeah, that's because selectedTarget is typecast as a Transform, while my code specifies it as a GameObject. My bad. :D Change this line: selectedTarget = hit.collider.gameObject; to: selectedTarget =...

View Article

Answer by Kleptomaniac

Here's how. Just use an array of materials and cycle through them with each successive mouse click. Then apply your newly chosen material to your mesh and your good! So like this: var matArray :...

View Article

Answer by Kleptomaniac

Yes, this is because of the structure of arrays. Let me explain. Say you were to have an array of ints called intArray which contains [5, 10, 15, 20, 25, 30, 35]. The way in which array elements are...

View Article

Answer by Kleptomaniac

This is easy to implement. Add all your FPC's to a built in GameObject array in the inspector: `public GameObject[] charInst;`. Depending on how you want your GUI button layout to be, you can link an...

View Article


Answer by Kleptomaniac

Hey there, All you need to do is store your ID within tags assigned to your individual GameObjects like so: `gameObject.tag = ID;` and then use [GameObject.FindGameObjectsWithTag()][1] to find your...

View Article

Answer by Kleptomaniac

It means that EtceteraManager.cs is referencing the class AbstractManager, however AbstractManager doesn't exist for some reason or another. It's likely that the AbstractManager script is either...

View Article


Answer by Kleptomaniac

Hey there, Although you have failed to present any code (which makes helping you that much harder) I can give you a generalised answer. All you need to do is base your GUI rendering on a boolean...

View Article

Answer by Kleptomaniac

This is not the correct way to format that conditional. Unless I'm mistaken, the only syntactically correct way to accomplish what you want is like this: if (Vector3.Distance(playerTransform.position,...

View Article


Answer by Kleptomaniac

Hey there, Not super sure what you're asking here, but I'll give it a crack. Do you just want to make it so you can open the gate with an arbitrary number of keys as opposed to just E? if...

View Article

Answer by Kleptomaniac

Hey, Having read your last comment, I believe I understand what you want now. Try using [Quaternion.Lerp][1]: float maxRot = 45.0f; //Max neg and pos strafe rotation value float rate = 2.0f; //Rate of...

View Article

Answer by Kleptomaniac

Hey there, You're going about this the wrong way. Instead of hard-coding your gun to follow the rotation of the camera, all you need to do is parent you gun GameObject to your camera. You can do this...

View Article

Answer by Kleptomaniac

Nobody here is giving you a clear answer. I would set out your script like so: #pragma strict var topdownCam : GameObject; private var cameraFollow: CameraFollow; private var planeSelfMove:...

View Article


Answer by Kleptomaniac

Ah, after reading your question a few more times, I think I've finally got it. The reason that this is happening is because you have *two* cameras, and you are changing the ShakeRotation on the camera...

View Article


Answer by Kleptomaniac

In order to randomly affect the x and y travel direction of your pellets, instead of having `Vector3(0, 0, speed) * Time.deltaTime`, try using [Random.Range][1]. So therefore:...

View Article

Answer by Kleptomaniac

This script is kind of a mess. Here is it cleaned up and optimised: //Got rid of ApplyDamage() here, because it seemed to bear no purpose var maxHealth : int = 100; //Typed these, as dynamic typing...

View Article

Answer by Kleptomaniac

I solved this a while ago by using LateUpdate() ... not sure if it is exactly a legitimate solution but it seems to work fine: function LateUpdate () { if (transform.rotation != Quaternion.Euler(0, 0,...

View Article


Answer by Kleptomaniac

The problem is that when you run you OnCollisionEnter() function, you call `Destroy(this.gameObject)` before you are even able to increment your score. This means it will not work as this script is...

View Article

Answer by Kleptomaniac

Do a tag check. For example: if (collision.gameObject.CompareTag("Target")) { Destroy(collision.gameObject); } This will only destroy objects tagged with the word "Target". Do the targets have a...

View Article

Answer by Kleptomaniac

I would suggest simply implementing a trigger collider for each section of the game in which you want to initiate dialogue. You can do this by simply setting up an empty GameObject with a Box Collider...

View Article

Answer by Kleptomaniac

You should really be using the [Event class][1] for event handling in OnGUI(), due to the fact that the OnGUI() function has multiple passes per frame and will thus repeat Input calls more times than...

View Article



Answer by Kleptomaniac

This means that an object reference had not been assigned to your orbs variable. Have you rechecked it in the Inspector to see that it hasn't lost your reference?

View Article
Browsing latest articles
Browse All 90 View Live




Latest Images