Tag Info

Hot answers tagged

17

Unity 4 uses Mono 2.6, which is a full implementation of the .NET framework, including the C# language. I'm not sure how it looks different, but keep in mind that Unity supports several languages, all of which work on top of the same Mono runtime. Is it possible you're confusing C# with UnityScript?


5

For 3D, Unity uses PhysX. According to this answer, PhysX uses a symplectic integrator. The paper it cites as evidence is a bit more ambiguous though: Since it is a commercial engine the implementation details are unknown ... Most physics engines provide results similar to the Symplectic Euler integrator, or 2nd order Euler. Novodex (Ageia PhysX) ...


4

The very first question all beginning Unity developers have is C# or JS. Always go with C#. Now, right now you may be thinking, "But I don't want to learn C# and I already know a bit of JavaScript." But the misleading thing you need to consider is that Unity JavaScript is not JavaScript. It is a superficial veneer of ECMA syntax over .NET CLR. It does not ...


4

I will assume that you have a function f such that the surface is defined by f(x,y,z)==0. Right now, all you have is the function f itself, and so with no further information, it is impossible to know when to subdivide. It is always possible for the surface to do what you describe, i.e. the function f can have arbitrarily thin "fins" which can require you do ...


4

Flip a switch depending on the walls' collision face: bool runForwards = true; public void WallCollsionHandler(Collider collider){ if(collider.tag == "Left Facing Wall") { runForwards = false; // Or // JumpBackwards() } else if(collider.tag == "Right Facing Wall") { runForwards = true; // Or ...


3

Multisampling AA (MSAA) is only capable of multisampling the geometry edges. If you want your sprites to be anti aliased, you should use a post process AA, like FXAA for example. You can also use bilinear filtering to smooth out the texture itself (it seems that you are using point/nearest filtering). Having multiple mip-maps for your textures can also ...


3

Have you tried using ShoeBox it has many utilities for SWF files. One of those allows you to create spritesheets from a SWF file.


3

Create an invisible box in front of the fan. Then check if some object is inside that box. Apply movement to that object. This can be done in unity quite easily. Create Empty gameobject Select the new gameobject Add Component-> Mesh -> Mesh filter Select from inspector -> Mesh filter -> mesh and set it to "cube" ( or what ever shape you want ) Add ...


3

Use the AND symbol to test if both buttons are down in an if statement. In C++ and C# it would look something like this: if(BUTTON_A_PRESSED == true && BUTTON_B_PRESSED == true) { /* DO SOMETHING */ } Otherwise you could use a nested if statement like so: if(BUTTON_A_PRESSED == true) { if(BUTTON_B_PRESSED == true) { /* DO SOMETHING */ } } Hope ...


3

You can access any object in your hierarchy by searching for it: GameObject soundObject = GameObject.Find("BackgroundSoundObjectName"); Then you're likely going to want to access the AudioSource component: AudioSource audioSource = soundObject.GetComponent<AudioSource>(); Then you can use the Pause() and Play() methods of the audio source to ...


3

Unity uses regular C#. Then again, when you write C# in Unity you will be using a lot of their libraries, but as far as I know, everything possible in C# is possible in Unity, other than the differences listed below: More specific areas of .Net relating to Windows Forms & ASP are off limits through Unity. While you can use Visual Studio for editing ...


3

This is most likely down to the frame rate, which makes me wonder how can I make sure that a coroutine takes the precise amount of time it should take despite the fluctuating frame rate? I don't think you can, honestly. Coroutines are at the mercy of Update() in the same way the rest of your code is. You can't make it end between two update loops, ...


2

Another way to handle this, which works well if your objects don't move, is to save the position of the object before you start the animation. Like so: startPosition = transform.localPosition; animation.Play("testAnim"); Then during LateUpdate, you jus add that position on top of the position of your object, which effectively shifts it by ...


2

Unless you have the screens at angles greater than roughly 45 degrees, you should be able to create a viewport that covers the three screens, and have it look realistic. Instead of having a 1600x900 viewport, you would have a 4800x900 viewport. I would not recommend having three separate cameras. If the displays render slightly out of sync, it can disorient ...


2

Yes, you can implement this with three cameras. There's a few ways to approach this, and none of them are built in easy to use solutions from Unity. Create one large borderless window that spans multiple screens (for example you can use the command line argument -popupwindow). You'd then set up each camera to take up the portion of the window that is ...


2

The error is in the slide, the correct implementation is: for (size_t i = 0; i < N; i++) { for (size_t j = 0; j < M; j++) { size_t n = i * N + j; size_t a = i == 0 ? i * N + j : (i-1) * N + j; size_t b = i == N-1 ? i * N + j : (i+1) * N + j; size_t c = j == 0 ? i * N + j : i * N + (j - 1); size_t d = ...


2

the problem is with rectangle = GUILayout.Window(0, rectangle, ShowGUI, "Prescription"); since both of them have an ID of 0, unity tries to make 2 different windows with the same ID, causing a crash. All you need to do is give one an ID of 0, the other an id of 1, so the other would look like rectangle = GUILayout.Window(1, rectangle, ShowGUI, ...


2

Just go really simple. Add a flag to the player that tells the camera when they're jumping. If they're jumping, don't follow them up. The other situation you need to handle is when the player jumps up or down to different levels. In this case it would be pretty simple to start tracking again when the player touches down, or if the player goes below the ...


2

One thing I've done in the past for island shapes is to use perlin noise minus a circular shape. It usually produces one big island and some little things off on the side. You can use flood fill or smoothing to remove any small noise. Here's a demo (flash) that I wrote for this question. For each location (x, y) in the noise bitmap, compute the distance ...


2

You can do this using plain mouseup/down tests and raycasting, and the same pattern applies to many other situations, like marquee selection. // Call this inside an Update method. void HandleDragging() { const int mouseButton = 0; // button values are 0=left,1=right,2=middle if(_isDragging) // Leading underscore denotes private member variables ...


2

To begin with, in order to access and update your board with ease, you can make use of the Dictionary<Key, Value> class together with the Vector2 structure defined by Unity. Dictionary<Vector2, Tile> tiles = new Dictionary<Vector2, Tile>(); Tile is a class defined by you. It should contain information such as its coordinates on the ...


1

You need only simple collision detection for something like this: You could just compare the X-coordinate of the nearest wall with that of the player when the player throws a punch. Something along the lines of if (wall.x - player.x <= 50 && wall.x - player.x > 0) { // The wall is in a good position! } else { // The wall is out of ...


1

There are a number of tools for this purpose. Flash itself has an option for something like Export to PNG Sequence. Texture Packer also can import a SWF. Yet another option, which I used to create the spritesheets for the HTML5 demo on my site, is Zoe, the spritesheet tool that comes with CreateJS.


1

I'm guessing you mean "Flash Pro". You can export a sprite sheet directly from inside Flash Pro. Instructions are available on Adobe's web site. http://helpx.adobe.com/flash/using/create-sprite-sheet.html This will take a snapshot of each frame of the animation, at the interval for the frame rate you specify, then combine all the frames into a grid in a ...


1

You might try using Flump: http://threerings.github.io/flump/ You'll have to port one of the existing client libraries to Unity, but the client libs are simple and should be pretty easy to port. Most of the heavy lifting is done by the exporter.


1

While not exactly what you're looking for, this post on reddit might be of interest - an upcoming tool for rendering swf animations in Unity, from the sounds of it the performance is good and you still retain the cross-platform functionality.


1

I figured out how to fix this, but I'm still not entirely positive what the actual problem was. My rotation was very simple and was only in the X axis. The Y and Z axis remained at 0 throughout the rotation. However, if I manually type 0 into these boxes (even though they are already 0) the weird rotation problem goes away. This is repeatable. If I ...


1

It's easy to check if those are both down. Just use IF with && and operator. Here is two examples for Unity, ready to run. Just place these to any script on an object that is in scene. function Update () { if (Input.GetKey ("up") && Input.GetKey ("down")) print ("Pressing Up and Down"); } However, this activates every frame and ...


1

If you have multiple audio sources, FindObjectsOfType might be useful (The UnityEngine.Object part is unnecessary if called from a MonoBehaviour-inherited script): AudioSource[] allAudioSources = UnityEngine.Object.FindObjectsOfType<AudioSource>();


1

There are multiple ways to handle this issue, it depends on your game and what will work best. For example, on our game Tyrant Unleashed we simply made wide maps with unimportant detailing on the sides, so that it's okay to cut off the sides on narrower devices. However other games might be better with an approach where you actually shift buttons around or ...



Only top voted, non community-wiki answers of a minimum length are eligible