Quantcast
Channel: Answers by "Mortoc"
Browsing latest articles
Browse All 73 View Live
↧

Answer by Mortoc

Photon and SmartFox are for synchronous communication; real-time multiplayer games. Web services are used for asynchronous communication; high score saving, login systems, etc. If your need is...

View Article


Answer by Mortoc

You want to detect direction of vectors by using the dot product. if( Vector3.Dot(transform.forward, Vector3.forward) > 0.0f ) // dude is walking forward Here's a pretty clear way to learn about dot...

View Article


Answer by Mortoc

I see a couple problems: - ToList returns an object of Type List and you're attempting to assign it to a Transform[]. - ToList(Transform) should read ToList(transform) (get the instance name, not the...

View Article

Answer by Mortoc

You'll need a couple things. 1. An efficient way to detect proximity. [Physics.OverlapSphere][1] or just colliders set as triggers are good for this. This is so you can say, "Enemy is close to player,...

View Article

Answer by Mortoc

It is very easy to copy any object. Use [UnityEngine.Object.Instantiate][1] You can also procedurally move things around very easily in unity: "GameObject.transform.position = someVector3;" You can...

View Article


Answer by Mortoc

How is the font asset saved? if it's not, maybe try forcing it to import as Unicode instead of dynamic.

View Article

Answer by Mortoc

What sort of DLL are you talking about here? A .net DLL can just be dragged in to unity (assuming it doesn't have any weird requirements like System.Windows). If it's a native dll (from C++ or...

View Article

Answer by Mortoc

The *most* efficient way would be to use option 2 (GUITexture with alpha across the screen) for a single frame, setting the camera to not clear out the display buffer and then disable rendering of...

View Article


Answer by Mortoc

I'm not sure why the script wouldn't compile straight out of the box, but the compile error looks simple enough to fix. It's an interface you implement rather than a base class to extend. You can use...

View Article


Answer by Mortoc

It would look something like this. You could put this script on a GameObject and in the editor set up as many units in that array as you want. I do recommend using better names than I did: public class...

View Article

Answer by Mortoc

Sounds like z-fighting. Try using a shader that includes an offset. Simple example: Shader "No More Z Fighting/Foreground Element" { Properties { _MainTex ("Main Texure (RGBA)", 2D) = "" {} } SubShader...

View Article

Answer by Mortoc

There's a couple different things going on in From Dust, but I think the basic thing you're looking for is the [Marching Polyhedrons][1] algorithm. It's used to generate a 'shell mesh' over a point...

View Article

Answer by Mortoc

Your iteration variable has the same name as your member variable. Change the iterator (ent1) variable to a different name.

View Article


Answer by Mortoc

You can use the GUIStyle.CalcHeight function for this: http://docs.unity3d.com/Documentation/ScriptReference/GUIStyle.CalcHeight.html I'm assuming that the variable 'Answer' is your GUIStyle and...

View Article

Answer by Mortoc

You can use the normal C# System.Threading library. Here's the official MSDN tutorial: http://msdn.microsoft.com/en-us/library/aa645740(v=vs.71).aspx Just be careful not to call any Unity API functions...

View Article


Answer by Mortoc

If you keep track of your "wall" or plane as point-normal, it's really easy ([Khan academy link for the math involved][1]). The code would look something like this: Vector3 wallToObject = wall.position...

View Article

Answer by Mortoc

Sounds like a decent time to use a Coroutine. Something like this: IEnumerator RunEvent() { while(varfloat < instant) { varfloat += Time.deltaTime; yield return 0; } RunEvent(); }

View Article


Answer by Mortoc

You should be able to make them all the same mesh without adding tris. In your 3D modeling tool just combine all the meshes in to a single object. For prop-sized objects, that's pretty much the rule of...

View Article

Answer by Mortoc

Bug in your code. You probably want this: void Start () { GameObject newobj = new GameObject("Testing"); newobj.transform.parent = transform; // this transform, not the parent...

View Article

Answer by Mortoc

You can use http://docs.unity3d.com/Documentation/ScriptReference/TextAsset.html I recommend formatting your data in JSON or XML so that it's easier to read/maintain later on.

View Article

Answer by Mortoc

The problem you have is here: movement.x = Input.GetAxis("Horizontal") * speed; movement.z = Input.GetAxis("Vertical") * speed; You're applying movement in "world-space". If you want to move in...

View Article


Answer by Mortoc

Typo in the function name: OnControlerColliderHit should be OnControllerColliderHit

View Article


Answer by Mortoc

Well, moving is getting set to true and it's defined outside the scope of MoveFromTo. That means the 2nd call to MoveFromTo doesn't do anything.

View Article

Answer by Mortoc

I'd start by looking at Lua. It's a pretty common modding language and it's pretty easy to set up in Unity. http://www.dannygoodayle.com/2013/05/31/integrating-unity-with-lua-in-two-minutes/

View Article

Answer by Mortoc

I've gotten this a few times too. If you navigate to your Documents folder (C:\Users\nmona_000\Documents), right-click it and hit Properties. In there, uncheck readonly under Attributes and make sure...

View Article


Answer by Mortoc

Nope, you can't block while waiting for a Web request, nor would you want to (your app will appear to have crashed). You can split your app in to 2 scenes, 1 would be the loading scene that does the...

View Article

Answer by Mortoc

Instead of myTransform.Translate (Vector3.up * lightningSpeed * Time.deltaTime); try: myTransform.Translate (transform.forward * lightningSpeed * Time.deltaTime); This uses the forward vector on the...

View Article

Answer by Mortoc

Right now your scripts are modifying transform and rigidbody. You want to modify one or the other per-gameobject, not both. Also, any modifications to rigidbody should be done during the Physics...

View Article

Answer by Mortoc

// assuming the ground is on it's own layer called 'ground-plane' int mask = 1 << LayerMask.NameToLayer("ground-plane"); // get the 2 camera-corner rays Ray topRightRay =...

View Article



Answer by Mortoc

Move this code from Update to FixedUpdate since it's dealing with physics (the rigidbody).

View Article
Browsing latest articles
Browse All 73 View Live