# Tag Info

1

Look at the "FreeLookCameraRig" object you put into your hierarchy. When you expand it, you will notice that it has a child object "Pivot" which has a child object "MainCamera" in it. You can control the relative positions of these objects to each other. Just move the camera closer to the pivot. Alternatively, you can reduce the field of view of the ...

0

Let's break this down. In your response function, you are doing two relevant things: RequestInterstitial(); Invoke("wrong", 1); I suspect what is happening is the first statement is trying to load a new ad, while the second one waits 1 second to display. If the network connection is within 1 second, the ad will display, otherwise, you won't see anything. ...

4

To get a constant rate of movement for your walkspeed, you can normalize your distance between the player and the enemy. A normalized vector still points to its original direction, however it has a length of 1, thus, getting you constant results when multiplying with your walkspeed. The math behind it, for a vector v to its normalized version vn: vn = ...

3

The parameter you pass to transform.Rotate is a a vector with 3 elements. The 3 elements say how far to rotate around the x-axis, y-axis and z-axis. Vector3.right and Vector3.left are shorthands for Vector3(1.0f, 0.0f, 0.0f) and Vector3(-1.0f, 0.0f, 0.0f). These are rotations around the x-axis. When you want to turn an object around the z-axis, for example, ...

0

I worked it out finally. I use forward and back as the rotation direction. I was literally just rolling through vector options to find it though. Pure luck haha

0

Close Unity and open explorer. Now search all the .meta files from your project. Delete them all and open Unity again. It will create new meta files. And issue would be resolved.

1

This is the online tutorial I used for InnoSetup, and I can confirm it worked for me. At the part about the DataFolder they say this: Point the wizard to the main executable of your game. Now we have to add the MyGame_Data folder. Click the Add folder. A quick note about the MyGame_Data folder. You can select it directly, then click edit and set ...

5

The problem is that the image effect grab the current screen after render. Since your camera render directly to backbuffer (they only clear depth), the image effect is apply to everything. Solution can be : Setup a Camera first that clear to a transparent color, with a setup RenderTarget (you can create it by script so it is the same size as your screen) ...

1

Why not using a custom method to take screenshots and save them wherever you want ? I use this method in my games: private IEnumerator TakeScreenshot(string screen_path) { yield return new WaitForEndOfFrame(); int width = Screen.width; int height = Screen.height; // Creates a new texture of the size of your screen. ...

0

I got the script working with a little help thanks for all your input. by putting the score in a separate script and defining the player object in this script it works perfectly. using UnityEngine; /// /// Handle hitpoints and damages /// public class HealthScript : MonoBehaviour { /// /// Total hitpoints /// public int hp = 2; ...

1

Okay you'll never use high poly models in the actual game itself. The purpose of a high-poly model is to provide your low-poly silhouette model "DETAIL" information for baking. Two different methods for creating models. 1) Low to High 2) High to Low Low to High is for modelers that are more methodical. Like Maya Artist to Zbrush High to Low is more ...

0

1

Lets start with the easiest, the segment from p0 to p1. First of all you need the perpendicular direction to this segment. To do this get the "normal" direction first simply subtract one point from the other, then use the well-known trick to get perpendicular vector (swap coords and negate one): Vec3 seg01_dir = (p1 - p0).Normalize(); Vec3 seg01_perp = new ...

1

With "go down" do you mean "tilt down" (as in "you lower your head") or "move down" (as in "you go down on your knees")? Anyway, both are done by manipulating the Transform-component of your camera. Camera.main.transform.Rotate(vector3); rotates the currently active camera and setting Camera.main.transform.position = vector3; moves the camera to a ...

2

I think your question is about modelling assets for your game and whether you should start with a low or high poly prototype. To me it makes sense to prototype quickly and therefore choose whichever takes you the least amount of time... That doesn't always mean low-poly (though in general it is usually quicker to build a prototype model out of simple ...

2

Mesh.vertices is a property, not a variable. According to docs, it: Returns a copy of the vertex positions or assigns a new vertex positions array. Which means, when you call mesh.vertices, you don't get the actual vertices, you get a copy of actual vertices. So when you copy something to this array, you actual modify the clone, not the actual data, ...

0

Modifying the bounds is impossible for a good reason, which is that the bounds is just an AABB (i.e. non-rotated box) which encloses the entire sprite or mesh. It just shows where, in the form of a box unaffected by rotation, the mesh/sprite reaches. Kind of like a connect the outer dots with lines aligned with the x, y and z axis and is thus just a way of ...

-2

In unity, a vector is implemented as a struct as opposed to a class. One thing this means is that you can not change individual values in a vector by assigning directly as you have done. You need to replace the entire vector with a new one. So: var old = rend.bounds.max; rend.bounds.max = new Vector3(old.x, 20, old.z);

1

You aren't doing anything with rotationsArray, you are just swapping the values in bone1Rot and bone2Rot around. You need to actually modify the array, something like: private void ChangeRotations(Quaternion[] rotationsArray) { Quaternion temp = rotationsArray [(int)Bone1ID]; rotationsArray [(int)Bone1ID] = rotationsArray [(int)Bone2ID]; ...

0

for second and third question: try following this aproach . The post make reference to colliders but you can use it with tiles. Essentialy you can use big rectangular quads to enclose the same tiles like this: Using larger quads reduce the tiled light effect.

3

Simple typographical errors, the bane of every programmer ever. In the end, all I had to do was swap these two lines, simply because I was attempting to use the Rigidbody of the object before I assigned it a value. this._bodyRigidbody.AddForce(this.startingForce); this._bodyRigidbody = GetComponent<Rigidbody>(); After swapping, these two lines ...

2

When you assign this script to every enemy and player, then every enemy and player has their own score. When an object dies, it adds 100 to its own score, not the score of the player which killed it. Possible options to fix this are: change int score to static int score, which means that the value is shared between all instances of the behavior. This is ...

2

Don't have enough points to comment but have you tried turning of Has Exit Time

1

1

The .NET version of Chromium Embedded Framework (CEFSharp) does have a version for offscreen rendering, however you need to handle converting the rendered screen into another image format to use with your framework of choice (in this case Unity). There also does seem to be a recent discussion about integrating it into Unity. As for alternatives, there is ...

0

There was a project, Awesomium for Unity, but I don't know in what state it is right now, but what I've got after a few google lookups it got quite stagnant if not completely on hold. But there is an alternative, here: Coherent-UI. You should check that up. But, if you want to use CEF, then be prepared to do some "low level bit pushy trickery", but I'd vouch ...

0

Its not possible to upload a local image to Facebook. The image has to be on the cloud. You can try the alternative approach described in this answer - http://stackoverflow.com/a/32264318/3148917

0

Add a Vector2 private variable to your class. This variable will tells you at any time where your character is facing: private Vector2 facingDirection = Vector2.zero; ... void FixedUpdate () { Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); if (movement_vector != Vector2.zero) { ...

0

I almost gave up but finally solved it. Unity converts everything to binary variable so that the first thing you need to do is to convert all xml files you have to txt and copy them to "Assets/Resources" folder. Then, you can use following code: TextAsset asset = Resources.Load("file" + select.ToString()) as TextAsset; Stream s = new ...

1

A guy on my development team actually found the source of the problem: Unity has an internal Bounce-Threshold. If the velocity towards one axis does not reach this Threshold the velocity will be set to 0. This is a nice feature for normal game physics, as bouncing objects will come to a rest faster, but you can't build a perfect bouncing ball without ...

2

Add the polygonCollider2D.enabled = false line after the yield return in the coroutine instead. In your code this line is executed immediately because a coroutine is executed over multiple frames based on what it yields. Whatever is after the yield return statement will be executed after seconds seconds, but while the coroutine is waiting control is returned ...

2

Quite simply put, Evorlor is right. Use the script, only look at the shader if performance becomes an issue, not when it's simply a concern. I implemented a scripted solution (option #2) with a default renderer first. It took about 10 ms per frame, with 1000 meshes with 10 triangles each. As it turns out, almost all of the performance cost in this case came ...

0

For Unity, I would just recommend using their analytic service, which allows you to store String data (not just numeric data like many services) so you can capture things like which game mode or level was most played, user hardware specs, basically anything. https://unity3d.com/services/analytics The API is also very simple to use and integrate, much ...

0

For very simple and limited(in numbers) you could give each of your items tag. Alternatively, you can take advantage of the OnTriggerEnter(Collider other) method signature - the one of the colliding object will be this(.gameObject) and the other one is other.gameObject. This way you can access attached components directly, including all scripts. So assuming ...

0

The simplest solution would be to setup a web server that saves the data. Make the client send data once in a while via http. Save the data in a database like MySQL, and create a page to view the data. Remember to add security if you're sending anything critical. "and make sure you have your users agree to that fact in the ToS, and make sure you review ...

0

Changing the EventSystem's following values: Input Actions Per Second: 2 Repeat Delay: 0.3 This makes it more responsive, but is not ideal because it involves changing the EventSystem present in every scene. If someone has a better solution, I'd be happy to hear it.

1

What you are trying to do is "load an asset". Here's how: http://docs.unity3d.com/Manual/AssetDatabase.html using UnityEngine; using UnityEditor; public class ImportAsset { [MenuItem ("AssetDatabase/LoadAssetExample")] static void ImportExample () { Texture2D t = AssetDatabase.LoadAssetAtPath("Assets/Textures/texture.jpg", ...

-1

We had the same problem but finally we solved it. The problem was the gameobject which holds the Animator component must be active on the scene before you set the variables.

1

Firstly, while your variable may be named currentForce, it actually only contains the vector pointing from this to this.twinObject. Furthermore, with your addition, the subtraction actually points toward the first object. Think of vector a in this image to be your this.transform.position and vector b as your this.twinObject.transform.position. So, since ...

1

This line: Vector3 currentForce = this.transform.position - this.twinObject.transform.position; This gets you a vector pointing from twinObject toward yourself. By applying a force in that direction, you end up pushing yourself away from twinObject. Think of it using one-dimensional numbers: int difference = 5 - 2; //difference is now 3 //difference ...

0

When I had to do this in the past, I just parented the UI canvas for the text to the Camera. This should work for the first-party support for the Oculus available in Unity 5 now. Alternatively, if you're using a plugin like the OVR plugin or similar, you should still be able to track down a suitable parent for the text's canvas. e.g. The CenterEyeAnchor ...

1

No, Unity doesn't support expression bodied members. You'll find for most things, Unity is not at the cutting edge of C# / .NET features. That's because the version of Mono it uses under the hood to provide the Common Language Runtime across multiple platforms only handles up to about .NET 2.0-3.5 (circa 2005-2007): This restriction also applies to using ...

2

To Freeze Time (Game Time) Time.timeScale = 0; To restore Time (Game Time) Time.timeScale = 1;

0

What's causing the problem is setting the Animation Type of the rig to Humanoid. I guess this causes the animation to lose its mapping to non-humanoid related bones. What fixes the issue is setting the Animation Type to Generic like so:

0

Here's a method that won't foreshorten your forward & backward movement: Quaternion GetGroundFrame() { // You can replace this with a raycast if you have more complex levels, // to get the direction of the collision plane under the character. Vector3 groundNormal = Vector3.up; transform cam = Camera.main.transform; // Construct a ...

0

I was confused by your use of the term "interface", since that is a keyword that C# responds to. However, when you described a "callback interface" I realized you're talking about something different: a way for the Java code to call functions in Unity (rather than only the other way around). This is done using the command UnityPlayer.UnitySendMessage ...

4

Use an animated texture. There are some good ones in the store for < \$10. Add a Halo. You can use the particle system, or just a transparent glow texture in front of the sun with a script to re-position the texture when the camera moves. Rotate the sun, slowly. Use particle system for eruptions. Use a shader to make the edges of the ball glow brighter, ...

1

finally i can resolve my problem. using UnityEngine; public class FADE : MonoBehaviour { private float alpha = 1.0f; private float fadeDir = -1; public Texture2D myGUITexture; float fadeSpeed = 0.2f; int drawDepth = -1000; void OnGUI() { alpha += fadeDir * fadeSpeed * Time.deltaTime; alpha = ...

0

You have no control over the order in which scripts are Awake()ned. In general, a script should only reference itself during Awake(). Any code which relies on other game objects already being initialized should be in the Start() event.

0

This is an official bug in Unity Mecanim , similar problem posted on the unity forum http://forum.unity3d.com/threads/exit-time-of-1-but-animation-exits-before-finishing-full-example-included.319205/ . They have said that it will be fixed in Unity 5.2 , I currently have Unity 5.1 so can't confirm. A quick and dirty fix in your case will be to change the ...

Top 50 recent answers are included