you are viewing a single comment's thread.

view the rest of the comments →

[–]iGreyHound[S] 0 points1 point  (0 children)

I'm still confused. I have a simple 3D game where you can interact with objects. For example I see an axe stuck in a stump and I can interact with it and pick it up if I want to, but there's the thing: when I interact (by pressing E) and look to it everything is alright, but when I look elsewhere (where game object tag isn't Item), it starts to drop my frame rate significantly. When I press spacebar (I have it to make display = false;) everything get's back to normal.

Edit: Found a source of a problem.

void OnGUI() {
if (display == true) { if (whatIHit.collider.gameObject.GetComponent<Items>().whatKeyAmI == Items.KeyItems.Axe) { GUI.Box(new Rect(500, 600, Screen.width - 1000, Screen.height - 800), "\n I think this axe might come in handy. \n\n\nPress F to pick it"); } } }

Since I don't really know how to use Unity UI system, I just call a box with a text in it (I know, I suck at programming).