Quantcast
Channel: Answers by "Pharaoh_"
Browsing all 54 articles
Browse latest View live

Answer by Pharaoh_

What if you derive it from the Canvas? Canvas.FindObjectOfType?

View Article



Answer by Pharaoh_

Set reverse = X outside of the loop?

View Article

Answer by Pharaoh_

GUI elements are drawn in the OnGUI() method. Have you attached it to a game object? If you have, it should work.

View Article

Answer by Pharaoh_

In the Start() method, set InitY = GO.transform.position.y; In the Update() method, Vector3 newVec = new Vector3 (GO.transform.position.x, InitY, GO.transform.position.z);...

View Article

Answer by Pharaoh_

Every GUI element (unless you're using GUILayout without using BeginArea()) has a Rect requirement, where you define where each element goes. Top right for instance would be Rect (Screen.width - 100,...

View Article


Answer by Pharaoh_

Is there any reason why you play the animation so frequently? Instead, I would use OnCollisionEnter2D() to set the value to true and OnCollisionExit2D to set it to false. In each of these functions,...

View Article

Answer by Pharaoh_

Speculation: GetComponent : You keep adding the same script which causes the script to re-run. Did you mean GetComponent ()? Also, why is it that you are inheriting from that class?

View Article

Answer by Pharaoh_

Well the guy whose answer was accepted, linked an entry in the manual. That entry is no longer the same; it says it uses arbitrary units and not kilograms, unlike the scale of a mesh, which simulates...

View Article


Answer by Pharaoh_

if ((stripOffset & 1) == 1) -> if (stripOffset == 1)

View Article


Answer by Pharaoh_

This might be obvious, but why don't you check if the gameobject is not destroyed OnDisable()? As in, if this == null. P.S. From the accepted answer, however, it might be a stupid suggestion.

View Article

Answer by Pharaoh_

Well, I didn't notice you wanted to achieve that (I actually wonder what I was thinking). In that case, you can use a `Dictionary `. Textures are drawn on Rects. Thus, when you use OnMouseDown(), check...

View Article

Answer by Pharaoh_

Just attach an audio source to a game object that will not be destroyed (DontDestroyOnLoad()).

View Article

Answer by Pharaoh_

Attach a script on your colliders and make a GUIScriptName gSN variable. OnTriggerEnter(), check the tag of the collider (let's call it col). If col.gameObject.tag == "Enemy" then access the...

View Article


Answer by Pharaoh_

ball.transform.position = Vector3.MoveTowards(transform.position, target.position, step); Shouldn't this be (transform.position, target, step)?

View Article

Answer by Pharaoh_

Tick Best Fit. Make a tiny change, such as hit spacebar and then delete it to allow the change to occur (it sometimes bugs for me).

View Article


Answer by Pharaoh_

Remember that this finds a gameobject by name, not tag, if the latter is what you intended. It will return null when no gameobject with such a name is found.

View Article

Answer by Pharaoh_

Pretty much what @Cherno said, but you can use the inbuilt "Ignore Raycast" layer on the character controller.

View Article


Answer by Pharaoh_

What about setting it to Ignore Raycast layer?

View Article

Answer by Pharaoh_

GetComponent().anchoredPosition is what you need.

View Article

Answer by Pharaoh_

You need to give your unit some form of an attackDistance property. This will also indicate whether this object is ranged or melee. When your OnTriggerEnter detects an incoming collider, check whether...

View Article
Browsing all 54 articles
Browse latest View live




Latest Images