## 2d – Unity Colliders – How do I recognize objects in the vicinity without my detection areas recognizing each other?

How can I sort the types of both colliders in a trigger overlap message, such as: OnTriggerExit2D (Collider2D others)?

Example:

• Objects A and B both have a BoxCollider2D and CircleCollider2D Components.

• Then, Object A enters one of the trigger colliders of Object B,

• I can get Object B'S collider type with the is Operator.

How can I get the collider type from A?

The reason why I want that is that I only want collisions where Object A& # 39; s CircleCollider2D touched Object B& # 39; s BoxCollider2D,

void OnTriggerExit2D (Collider2D other)
{
if (other is BoxCollider2D)
// execute code
}


Here's a table of what I want: I just want to register trigger overlaps of CircleCollider2D to BoxCollider2D, With the is Operator, I can safely remove all collisions CircleCollider2D but collisions between two BoxCollider2D stay what I do not want.

+ ------------------ + --------------- + -------------- ---- +
| Line to column | BoxCollider2D | CircleCollider2D |
+ ------------------ + --------------- + -------------- ---- +
| BoxCollider2D | No | No |
| CircleCollider2D | Yes | No |
+ ------------------ + --------------- + -------------- ---- +


To edit
The real question was to identify nearby objects without the coverage area interfering with each other.

## Unity playback, perform animation, but keep a T-model in the background

I downloaded a figure in Mixamo without animation and then downloaded a separate FBX with animation, then without mesh. So I have 2 FBX files.

Then I added the model to my scene, added an animator component and created an animator controller. I add the animation in AnimatorController. This is how it looks like:

So I expect the model to run on Play, but the problem is how it appears. It looks like this:

The running animation is playing, but there is another model behind the current model in the background.

I do not know what happened and what I did wrong. Any ideas, please?

By the way, the Rig animation type is set to General. I've tried the same with Humanoid, still the same.

## unity – How are the emission codes for a prefabricated house switched on and off?

If I worked at Unity or not, I would have two classes / prefabricated houses and would swap. The idea is that the active object is replaced by another object that is inactive. Easy.

To do this, in case the interaction with the object is handled, you can instantiate a new object of the inactive type, copy the transform properties (parent, position, rotation, scaling), and destroy the old object.

You do not have to worry about the animation frame that is the object. You do not have to worry about changing the object or affecting other objects of the same kind. And you would not have to worry about changing materials. al.

I have no idea how to stop the emissions. al. I have only a passing knowledge of the unit.

## Unity WebGL Build: Why are only empty folders displayed?

I am trying to create my game created in Unity 2018.3 and I am trying to create it in WebGL. The problem is that the build was successful, but the folder is still empty. The following occurred:

That has never happened to me. Does anyone know how to fix this?

## Unity "Convert to Entity" does not work (render) with "Skinned Mesh Renderer" for animations

I'm trying to make a game with Unity's ECS and Job System.

I encountered a problem where "convert to entity" does not support the skin mesh renderer. The network is not rendered. I need it for animations.

On the positive side, Game Object Entity renders the skin mesh renderer. The downside is that Physics Shape and Physics Body are not supported. Convert to entity works.

I use Physics Shape and Physics Body for physics.

Would anyone mind telling me which options are open to me?

## Unity – How can I achieve a plexus effect with VFX Graph?

Thanks for responding to Game Development Stack Exchange!

But avoid

• Make statements based on opinions; Cover them with references or personal experience.

Use MathJax to format equations. Mathjax reference.

## unity – Unity3d CarController character positioning problem

I use the standard unit components CharacterController and Car and place an empty game object on the car where the camera will be placed when I am in the car. The empty game object is called "driver". The character control has a space called Head in which the head is located.

When I get into the car, I perform the following operation

GameObject car = GameObject.Find ("Car");
transform.position = car.transform.Find ("Driver"). transform.position + Vector3.up * 1;
transform.parent = car.transform.Find ("Driver"). transform;
Camera.main.transform.position = car.transform.Find ("Driver"). transform.position;
Camera.main.transform.rotation = car.transform.Find ("Driver"). Transform.rotation;


and to get out there, I use the following

GameObject car = GameObject.Find ("Car");
transform.position = car.transform.position;
transform.parent = null;
transform.rotation = Quaternion.identity;


My problem is, when I get into the car and get out again, the character is positioned at the position where I entered the car.

What am I doing wrong?

## unity – System.Runtime.Serialization.SerializationException when attempting to deserialize List

I'm trying to serialize / deserialize a class that contains inventory items.

The code is attached below.

First, I call "void AddOne" void a few times, then "void SaveFile" and then "void LoadFile".

In LoadFile, the following error occurs:

ex = "System.Runtime.Serialization.SerializationException: The end of the stream was detected before parsing was completed.  r  n at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run () [0x00288] in the <1f0c1ef1ad524c38bbc5536809c46b48>: 0  r  n at System.Runt ...


Does anyone understand my mistake?

using system;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
with UnityEngine;

Type of public listing
{
undefined = 0,
Pistol = 1,
Magnum = 2,
PistolAmmo = 6,
MagnumAmmo = 7,
Gun,
RifleAmmo,
}

[System.Serializable]
Public inventory: MonoBehaviour
{
public class InventoryItem
{
public int Amount = 0;
public int Row = 0;
public int Col = 0;
public int Rotation = 0;
public Type ItemType = Type.undefined;
}
public InventoryItem[] Items;

public void Start ()
{
Items = new InventoryItem[0];
}
{
InventoryItem n = new InventoryItem ();
Array.Resize (ref Items, Items.Length + 1);
items[Items.Length - 1] = n;
}
public void SaveFile ()
{
string destination = Application.persistentDataPath + "/save2.dat";

if (File.Exists (destination))
{
File.Delete (destination);
}
using (Stream stream = File.Open (destination, FileMode.Create))
{
BinaryFormatter bin = new BinaryFormatter ();
bin.Serialize (stream, this.Items);
}
}

{
string destination = Application.persistentDataPath + "/save2.dat";

using (Stream stream = File.Open (destination, FileMode.Open))
{
BinaryFormatter bin = new BinaryFormatter ();

To attempt
{
var nItemList = (List). Deserialize (stream);

Array.Resize (ref this.Items, nItemList.Count);
for (int i = 0; i <nItemList.Count; i ++)
{
this.Items[i] = nItemList[i];
}
}
catch (exception ex)
{
Debug.Log (ex.ToString ());
}
}
}
}


## unity3d – Network package for Unity design issues

I wanted to ask some design questions about a project that I would like to build. Right now I'm working on a package that allows any indie game developer to create a multi-player version of his game. I get arbitrary code by using Assembly.Load to load the objects / types of your game onto the server. These are packed while creating the game.

I've decided how to implement them in the backend, and from a server point of view, I've shut down object serialization, written over TCP / UDP, and can call arbitrary messages on any server-side objects.

In this last point is my question. I want to make this system a bit more platform dependent, so I can not serialize / send a game object for unitary purposes. More importantly, I do not think that I should. I think so NetworkEntity / NetworkComponent should not have any strict dependencies on GameObject I think it should be a network-dependent way to represent an object piece in the game room. Some examples are a NetworkHealthController or a NetworkPosition. Both represent only a few elements that the server manages to update / synchronize.

Does that make sense for the unit? Initially, I design mainly for the traditional, so a GameObject has several components, but one component would be one NetworkedComponent and would be limited in its integration with the game object, representing only data or behavior that the developer would like to have synchronized over the network.

Some of the problems I see are when referring to GameObject, as is the case with your network object: GameObject.GetComponent We would fail. Can I just not build in this case? Since I can not really solve things in the underlying C ++ game engine.

I hope I have explained that well enough and am happy about any advice I can get.

## unity – AudioClip, generated by an external process and loaded into the editor, does not contain any samples

I work on a custom ScriptedImporter – Let's call it LmmsImporter – the project files from LMMS sequencer loads as Audio clips. I do not analyze the project file. Instead, I expect users to install LMMS, configure the location, and then save their project files in their files financial assets Directory. After the asset settings have been configured, the import process looks like this:

1. Create command-line arguments based on the properties offered by LmmsImporter
2. Get a temporary path within the project Temp Directory (not the equivalent of the operating system)
3. Start an LMMS process that renders the imported project file with the arguments specified by (1) to the path specified by (2).
4. Wait for the process to complete.
5. Download the Audio clip to "runtime" (that is, in an editor script, not as an imported asset) with UnityWebRequestMultimedia.GetAudioClip
6. Clone the Audio clip,
7. Put the cloned one Audio clip Main object of the LMMS project asset as described here.
8. Save the imported asset and delete the original audio file created with (3).

Everything up to and including step 7 works as expected. In fact, even step 7 appear work as expected. But when I open the imported Audio clipIt has no samples. When I try to play the preview in the editor, the editor console displays the following error:



Error: FMOD :: Sound instance for resource can not be created (error loading file).
UnityEngine.GUIUtility: ProcessEvent (Int32, IntPtr)


What makes this strange is that:

• The sound is rendered correctly by LMMS and stored in the file system. Nothing unusual happens here.
• The playing Audio clip within the importer script immediately after it is loaded (ie still in OnImportAsset) With AudioSource.PlayAtPoint works as expected.
• The data is cloned properly. I checked if the arrays are the same.
• I do not receive any errors or exceptions except those I have already described, not even LMMS.

This is an excerpt from my code with the parts that I find the most relevant:

using system;
using System.Diagnostics;
using System.IO;
with UnityEngine;
Using UnityEngine.Networking;
with UnityEditor;
using UnityEditor.Experimental.AssetImporters;

[ScriptedImporter(1, new[] {"mmp", "mmpz"})]public class LmmsImporter: ScriptedImporter
{
// Properties omitted for the sake of brevity

public override void OnImportAsset (AssetImportContext ctx)
{
var relativeTempPath = FileUtil.GetUniqueTempPathInProject ();
var projectDir = Path.GetDirectoryName (Application.dataPath);
var absoluteAssetPath = Path.Combine (projectDir, assetPath);
var tempPath = Path.Combine (projectDir, relativeTempPath);

To attempt
{
using (Process lmms = new Process ())
{
// Call details and error handling are omitted for the sake of brevity
// ... a WAV, OGG or MP3 file was later successfully rendered ...

using (var request = UnityWebRequestMultimedia.GetAudioClip (new Uri (tempPath), audioFormat))
{
handler.compressed = false;
handler.streamAudio = false;

var operation = request.SendWebRequest ();

while (! (request.isHttpError || request.isNetworkError || handler.isDone));
// Let the request finish, unless we get an error (possibly including a timeout)

var assetName = Path.GetFileNameWithoutExtension (assetPath);
var clone = AudioClip.Create ("Clip", clip.samples, clip.channels, clip.frequency, false);

using (var so = new SerializedObject (clone))
{
var samples = new floats[clip.samples * clip.channels];

clip.GetData (samples, 0);
clone.SetData (samples, 0);

ctx.SetMainObject (clone);

so.ApplyModifiedProperties ();

EditorUtility.SetDirty (clone);
}
}
}
}
catch (exception e)
{
ctx.LogImportError (\$ "Error importing with {e.GetType ()}: {e.Message}");
}
}
private const int LOAD_MEDIA_TIMEOUT = 5; // seconds
}


I am using Unity 2019.1.7f1 staff under Ubuntu 19.04. Is this a mistake or am I doing something wrong?