Tag Info

New answers tagged

0

did you find a solution cause i'm facing the same issues?


0

As bitter said, Your file should be named "libmylibandroid.so" Drag and drop this file into your Unity Project Then, when you call the lib, just write : [DllImport("mylibandroid")] private static extern void FreeGlobals(); and not : [DllImport("mylibandroid.so")] private static extern void FreeGlobals(); Hope that will be useful for someone :)


1

I think Fuzzy Logic answer is best suited for your question (he got my +1), but i'd like to give a naif alternative. You can setup a bunch of Unity objects like quads, text, sprites (call all that TerminalStuff) and use a separate camera (call it terminalCamera) that capture the terminalStuff (perpendiculary). Then set the render output of terminalCamera to ...


0

The Unity documentation has a good example on how to achieve this with a useful example. http://docs.unity3d.com/ScriptReference/Vector3.Angle.html (example included below for illustration purposes) using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public Transform target; void Update() { Vector3 ...


-1

As to what you can legally do, the law looks at the terms of the license or the contract to which you have signed. The signing of publishing rights belong to the copyright holder(s). In the case of Unity 3D the run-time license remains the property of Unity 3D and does not transfer to the publisher or end-user. Instead the publisher is using a piece of ...


2

You will want to use Texture2D.SetPixel or Texture2D.GetPixels and Texture2D.SetPixels if you want to blit sprites onto your texture. You could render your sprites to a RenderTexture. It may be faster but until Unity5 it was a Pro-only feature (which I don't have) so I haven't experimented with it yet. You can't draw individual pixels on the GPU without a ...


0

The problem is that you are updating the existing rotation instead of tracking it yourself and replacing it each update. When you update the rotation it combines your new rotation with the old one which leads to unexpected behaviour. The solution is to to keep track of your accumulated rotation and reset the rotation entirely each update with your new ...


0

Your orthographic camera size depends on the pixels per unit of your sprites. Orthographic camera size is equal to 1/2 of the vertical units (meters if you use built in physics) you will see on the screen. Say size 6 means that your screen height will be 12 units. The formula is: screen resolution / 2*orthographic size = pixels per unit on sprites


1

In the Enemy script Update //assuming a as half of your vision cone angle //pseudo code foreach target { if (Vector3.Angle(target.position-trasform.position,trasform.forward) < a){ //then target is inside vision cone //next you can check vision distance ... //next you can check obstacles with a raycast ...


0

Usually when a texture is hidden in a 2D game, it's because it goes "in the back" of the screen. When you do lookAt(target), you have to remember that a Vector2 is just a vector3 with z=0 (thus, if you have z=1 for your background for example, it might go behind).


2

If you can have objects linked via the inspector and public/serialized fields, you should absolutely do it. It's the best way. FindObjectWithTag is for when your objects don't live in the same scene, and they don't have scripts for registering for each other. And finally, it's useful for when you need to reference a script before Awake has run, so it may not ...


0

So, in RotateParticleFinal I have a part that updates the alpha. That's only using floats. But when I check the actual particle to see if the alpha is at 1... well, it's a byte now. It was working better with a lot of debug calls because it slowed everything down, meaning I got a lot more alpha on my deltaTime based fade-in. Been wrestling with this for ...


0

Try this: int frameNumber = Mathf.FloorToInt(normalizedtimeOfFrame* totalFrames);


0

You have multiple versions of the dll that are both set to be used for the same platform or cpu. Unity 5 introduced new plugin settings so that you can compile different versions of the same dll, but you need to specify which platform or cpu each version is for. Checkout this link for more info. http://docs.unity3d.com/Manual/PluginInspector.html (Note: I ...


1

jhocking's answer about dot product is the right answer to the question, but if you are rotating your object over time to face the right direction, inside that function you must be calculating how much you have left to rotate so that you know what direction to rotate and so that you don't rotate too far and overshoot. That means that inside that function, ...


0

Actually the 2D-Vector solved the problem, I don't know why, because I think it should do the same but this is my code now and it's working Vector2 target = Camera.main.ScreenToWorldPoint (new Vector2 (Input.mousePosition.x, Input.mousePosition.y)); Vector2 myPos = new Vector2 (transform.position.x, transform.position.y); Vector2 ...


1

Calculate the dot product to determine how close two vectors are. The dot product is 1 when they are exactly the same, -1 when they are exactly opposite, 0 when they are perpendicular, and decimal values when partway. So take the current direction, the target direction, then Vector3.Dot() and check if greater than .9 (or whatever threshold you decide looks ...


0

You can use Quaternion.LookAt() always and then just move your object forward whenever you want.


0

You have to call you coroutine by writing "StartCoroutine( wait )". You should put something before and after the yield command or else it is skipped. Try creating a boolean and disabling or enabling it before and after the yield, then you could adjust your code to check for that boolean and then run.


0

What if you make the camera child of an empty gameobject. Then with one script you manage the empty gameobject rotation relative to UP vector.(MouseX) With another script atached to the camera gameobject you manage rotation relative to Right vector (MouseY)


0

Create a temporary variable for example named "rot" to hold the Input.GetAxis("Mouse X/Y) and then write: transform.Rotate ( rot ).


-1

You should create a layer on the object and in camera's culling mask enable the layer.


0

As long as you only have one spawner, it doesn't look like the spawner could be instantiating 10 platforms. However, it's definitely possible that you'll get two. On the frame after the platform is instantiated, if Spawner.Update() gets called before Platform.Update(), then spawnNewPlatform will still be true and another one will get created. Try setting ...


0

Unity let you set a collider "as trigger". You can set the isTrigger property true on the collider of the object you start to drag. Then use Collider.OnTriggerEnter(Collider) to check if the objects overlaps some other collider. When you stop to drag an object can switch to false its collider.isTrigger.


2

You have to use StartCoroutine (probably not in the Update) in order to start its execution. Otherwise it's only a method call: void Start() { StartCoroutine(wait(5)); }


0

Set your Pixel per Unit to 1 and try witch this: scale = Screen.height / nativeRes.y; pixelsToUnit *= scale; cam.orthographicSize = (Screen.height / 2.0f) / pixelsToUnit; Where nativeRes is your default resolution. Attach it to MainCamera and now your orto size should fit automatically.


0

You would use AnimationState.time It can be larger than the length of the animation, so to get the value with this, you would need to modulo with the animation clip length. float time = currentState.time % currentState.clip.length; You can also use Normalized Time, but you would have to mulitply the value by the length instead of the animation ...


0

While I personally love bunny hopping... As a starting point we should know the intended "Jump Speed" as a delta velocity. This figure represents the velocity increase (in the line with the "Jump Normal") during the instant of jumping once. Any velocity the player already has in line with the Jump Normal can be seen as a pre-existing "Jump Energy". This ...


0

First of all, i want to say that your question is very well written and it's a pleasure :), you would just need to remove what's not necessary in the code (audiosources, etc.) and it would be perfect. Cheers for that. For the answer, you could clamp your velocity when jumping, which would prevent you from reaching too high speeds when pressing the jump ...


2

Short answer: This doesn't do what you think it does. float pressure - A normalized value that describes the pressure applied to the device by a finger or other tool. The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), although values higher than 1 may be generated depending on the calibration of the input device. ...


1

I solved this problem using an hybrid approach, inspired by: my original workaround @Felsir's post @dnkdrone.vs.drones's post Solution I have Chunks, which may have an owner or be contested. Inside a contested Chunk, different players have their areas of influence. Instead of using a definite polygon/line border, inside the Chunk itself every player ...


0

There is two techniques for hiding the boundaries between disparate terrains. Blend over some distance. This is usually the best looking but requires that you have tiles that can be blended. This works well for grass, dirt and water terrain textures, for examples. A simpler approach is to use decorations/fringes to hide the seams at the boundaries. Similar ...


0

It depends on whether or not you have put your script on a game object. (Monobehavior is for that purpose.) If you have not, create an instance of it the normal way. StudyScreen studyScreen = new StudyScreen(); then your update would be: void Update () { if (Input.GetKeyDown(KeyCode.Alpha1)) { studyScreen.StudyScreen(); } else ...


8

Other then the particale system and halo effects Vadim mentioned you could create your own shader effect. There is some introduction to shaders for Unity and the possibilities are endless.


2

Try using a Particle System and a halo effect. You could also add a light to the star and have a bloom effect on your camera.


1

To build level geometry within Unity, probably the best tool available is ProBuilder: http://www.protoolsforunity3d.com/probuilder/ However, the usual approach is don't build your level geometry within Unity. Build the level geometry in a 3D modeling tool, like Maya or Blender, and import that into Unity.


1

What you try to do is practically impossible. The primitives are there just for prototyping/placeholders. You will have to "get" those from outside of Unity. Or you can look at asset store, there are some assets sold that can do limited 3d modeling.


0

You need to blend in natural looking borders. Different biomes need different types. Forest Rock walls that are obviously to high to climb Cliffs you cannot possibly climb down. You could make the player fall and kill himself here. Rivers Fences for animals or private property Urban buildings blocked roads (concrete blocks and those signs) fences or ...


2

Is there any reason you are using primitives over meshes? The engine shines if you import custom models. So you can avoid the tedious process of modeling in unity by modeling in a program that is actually designed for that. The only other way I know off creating something like a door in unity without using multiple primitives is coding a mesh for it by ...


0

One way to solve this, is by parenting the object to the camera, when the object receives the OnMouseDown signal. This could look similar to this: function OnMouseDown() { Camera.main.transform.parent = this.transform; // Optionally, set some flag and smoothly move towards a Vector, same with the size Camera.main.transform.position = ...


1

This is very subjective. Digital Tutors is very good tutorial site offering top quality tutorial. It can teach you how to use a tool and goes on showing how they use it. But in the end it is not the tool that creates the art, it is you using the tool and be creative with it. That is something nobody can teach you. Digital tutors does have tutors and ...


0

It looks like there's a bug in Unity. I added another blank screen that would just load my image scene after 3 seconds.The blank scene doesn't show up, but my image scene is displayed.


1

Vertical Overflow is set to Truncate. In other words, the text cuts off when it reaches the boundaries of the text element. Note the Height 30 above? That's the vertical boundary; you want that to be taller. You probably also want to make the element wider, so that it wraps at the edge of the window instead of in the middle.


0

It depends on some points. If you have no problem with programming specially c# or javascript language you should choose unity. If you are a absolute beginner in making game you better choose Gamemaker. I think many game developers started with gamemaker. In the recent years Unity engine have been ahead of gamemaker and many other engines. Briefly if ...


0

Try attaching a script to your platform instances. Then in that scripts Start() method use Debug.Log to log the parent platforms Transform


3

Create your own timer, and attach it to the scene that is doing the image presentation. This is something that is very simple to do. float delay = 3; public Update() { delay -= Time.deltaTime; if (delay <= 0) LoadLevel("NextLevelToLoad"); } EDIT Apparently mobile runs the Update() of the first loaded scene while the splash is ...


4

Create a polygon from the points, do a "is-point-in-polygon" check. So whenever the players add a point that would expand the "area" regenerate the polygon. On the update do a simple position check against that polygon to determine if an object or player is inside the area or not.


4

I suggest this approach. Use voronoi 2d subdivision for your space (in the example the central points distr is (pseudo)random, but you can insert your logic) Then asociate a value to each point that results (in the example image) in different color for each cell You can play with the number of point and/or distribution to get more defined shapes. For ...


2

You might want to look into fur shading technique. This is what I would use for this type of grass, since the shorter the grass is the better the performance (less layers). Basically it works by layering the same surface multiple times in small increments: You can also change the horizontal offset to make the grass look bent.


0

Create a public variable and make it's type the name of the class you want to access so then just assign the script with the class to your variable in hierarchy and after that you can access the variables and functions in the class. Hope that helps.



Top 50 recent answers are included