2d – Resolved :: The Unity tilemap Collider does not collide with a rigid body

Thank you for contributing an answer to Game Development Stack Exchange!

  • Please make sure to respond to the question. Provide details and share your research!

But to avoid

  • Ask for help, clarification, or answer other answers.
  • Make statements based on opinions; save them with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, read our tips for writing good answers.

advertisements – Unity Ads error

I am new to Unity and I was trying to build it. but after adding the announcements of the unit to the game, I started to have the error. please help

UnityEditor.BuildPlayerWindow + BuildMethodException: 2 errors
on UnityEditor.BuildPlayerWindow + DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x00234] in C: buildslave unity build Editor Mono BuildPlayerWindowBuildMethods.cs: 190
on UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x0007f] in C: buildslave unity build Editor Mono BuildPlayerWindowBuildMethods.cs: 96
UnityEngine.GUIUtility: ProcessEvent (Int32, IntPtr)

The build is complete with the result 'Failed & # 39;
UnityEngine.GUIUtility: ProcessEvent (Int32, IntPtr)

CommandInvokationFailure: The Gradle generation failed.
C: Program Files Unity Editor Data PlaybackEngines AndroidPlayer / Tools OpenJDK Windows bin java.exe -classpath "C: Program Files Unity Editor Data PlaybackEngines AndroidPlayer Tools gradle lib gradle-launcher-4.6.jar "org.gradle.launcher.GradleMain" -Dorg.gradle.jvmargs = -Xmx4096m "" assembleRelease "

stderr[
Note: There were 11 duplicate class definitions.
(Http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)

FAIL: Build failed with one exception.

  • That's what did not go well:
    The run failed for the task: transformClassesAndResourcesWithProguardForRelease & # 39;

    Work failed, see the logs for more details

  • Try:
    Run with the –stacktrace option to trace the stack. Run it with the –info or –debug option to get more log output. Run with –scan to get complete information.

  • Get more help on https://help.gradle.org

BU LD FAILED in 41s
]stdout[
:checkReleaseClasspath UP-TO-DATE
:preBuild UP-TO-DATE
:extractProguardFiles UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:compileReleaseAidl NO-SOURCE
:compileReleaseRenderscript UP-TO-DATE
:checkReleaseManifest UP-TO-DATE
:generateReleaseBuildConfig UP-TO-DATE
:prepareLintJar UP-TO-DATE
:mainApkListPersistenceRelease UP-TO-DATE
:generateReleaseResValues UP-TO-DATE
:generateReleaseResources UP-TO-DATE
:mergeReleaseResources UP-TO-DATE
:createReleaseCompatibleScreenManifests UP-TO-DATE
:processReleaseManifest
:splitsDiscoveryTaskRelease UP-TO-DATE
:processReleaseResources
:generateReleaseSources
:javaPreCompileRelease UP-TO-DATE
:compileReleaseJavaWithJavac UP-TO-DATE
:compileReleaseNdk NO-SOURCE
:compileReleaseSources UP-TO-DATE
:lintVitalRelease
:mergeReleaseShaders UP-TO-DATE
:compileReleaseShaders UP-TO-DATE
:generateReleaseAssets UP-TO-DATE
:mergeReleaseAssets
:checkReleaseLibraries UP-TO-DATE
:processReleaseJavaRes NO-SOURCE
:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:transformClassesAndResourcesWithProguardForRelease
Request to incrementing alive workforce from 0. Current workforce (dead or alive) 0
thread-pool size=4
ProGuard, version 6.0.3
Reading input…
Reading program jar [D:YOY GAMETempgradleOutlibsunity-classes.jar] (filtered)
Reading program [C:Userspc.gradlecachestransforms-1files-1.1unity-ads.aar519bfb21c86b04870314be286ffabf26jarsclasses.jar] (filtered)
Reading program [C:Userspc.gradlecachestransforms-1files-1.1UnityAds.aarda1f426e0f34bf3f9ac2762fb11055ddjarsclasses.jar] (filtered)
Note: Duplicate definition of the program class [com.unity3d.ads.BuildConfig]
Note: Duplicate definition of the program class [com.unity3d.ads.IUnityAdsListener]
Note: Duplicate definition of the program class [com.unity3d.ads.UnityAds$FinishState]
Note: Duplicate definition of the program class [com.unity3d.ads.UnityAds$PlacementState]
Note: Duplicate definition of the program class [com.unity3d.ads.UnityAds$UnityAdsError]
Note: Duplicate definition of the program class [com.unity3d.ads.UnityAds]
Note: Duplicate definition of the program class [com.unity3d.ads.mediation.IUnityAdsExtendedListener]
Note: Duplicate definition of the program class [com.unity3d.ads.metadata.InAppPurchaseMetaData]
Note: Duplicate definition of the program class [com.unity3d.ads.metadata.MediationMetaData]
Note: Duplicate definition of the program class [com.unity3d.ads.metadata.MetaData]
Note: Duplicate definition of the program class [com.unity3d.ads.metadata.PlayerMetaData]
Reading program directory [D:YOY GAMETempgradleOutbuildintermediatesjavacreleasecompileReleaseJavaWithJavacclasses] (filtered)
Reading program [D:YOY GAMETempgradleOutbuildintermediatestransformsmergeJavaResrelease.jar] (filtered)
Reading jar [C:UserspcAppDatamplatformsandroid-28android.jar]
Reading jar [C:UserspcAppDatambuild-tools28.0.3core-lambda-stubs.jar]
Reading jar [C:UserspcAppDatamplatformsandroid-28optionalorg.apache.http.legacy.jar]
Reading jar [C:UserspcAppDatamplatformsandroid-28optionalandroid.test.mock.jar]
Reading jar [C:UserspcAppDatamplatformsandroid-28optionalandroid.test.base.jar]
Reading jar [C:UserspcAppDatamplatformsandroid-28optionalandroid.test.runner.jar]
Initialization …
Note: com.unity3d.services.ar.ARCheck: Can not find class dynamically referenced com.google.ar.core.Session.
Note: com.unity3d.services.ads.adunit.AdUnitActivity accesses a field & # 39; layoutInDisplayCutoutMode & # 39; in a dynamic way.
Maybe this is a library field android.view.WindowManager $ LayoutParams {int layoutInDisplayCutoutMode; } & # 39;
NOTE: The configuration explicitly specifies & ##; android.webkit.JavascriptInterface & # 39; to keep the library class &roid.webkit.JavascriptInterface & # 39 ;.
NOTE: The configuration explicitly specifies & ##; android.webkit.JavascriptInterface & # 39; to keep the library class &roid.webkit.JavascriptInterface & # 39 ;.
Note: 2 library classes were explicitly preserved.
You do not need to keep library classes; they are already left unchanged.
(Http://proguard.sourceforge.net/manual/troubleshooting.html#libraryclass)
Note: There was 1 unresolved dynamic reference to classes or interfaces.
You should check if you need to specify additional program jars.
(Http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: There was 1 access to members of the group by introspection.
You should explicitly consider keeping the class members mentioned
(using -keep or "-keepclassmassers").
(Http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
Note: you are ignoring all warnings!
Skip unused library classes …
Initial number of library classes: 4803
Final number of library classes: 874
Printing classes, fields and methods kept …
Inline subprograms …
Contraction…
Use of printing for [D:YOY GAMETempgradleOutbuildoutputsmappingreleaseusage.txt]…
Deleting unused program classes and class elements …
Initial number of classes in the program: 613
Final number of classes in the program: 607
Obscuring …
Printing the mapping to [D:YOY GAMETempgradleOutbuildoutputsmappingreleasemapping.txt]…
Preverifying …
Write an exit …
Preparation of the outlet pot [D:YOY GAMETempgradleOutbuildintermediatestransformsproguardrelease.jar]
Copy the resources of the program jar [D:YOY GAMETempgradleOutlibsunity-classes.jar] (filtered)
Copy the resources of the program jar [C:Userspc.gradlecachestransforms-1files-1.1unity-ads.aar519bfb21c86b04870314be286ffabf26jarsclasses.jar] (filtered)
Copy the resources of the program jar [C:Userspc.gradlecachestransforms-1files-1.1UnityAds.aarda1f426e0f34bf3f9ac2762fb11055ddjarsclasses.jar] (filtered)
Warning: Exception while processing task java.io.IOException: Can not write [D:YOY GAMETempgradleOutbuildintermediatestransformsproguardrelease.jar] (I can not read [C:Userspc.gradlecachestransforms-1files-1.1UnityAds.aarda1f426e0f34bf3f9ac2762fb11055ddjarsclasses.jar(;;;;;;;**.class)] (Duplicate bin entry [com/unity3d/ads/BuildConfig.class]))
Thread (Tasks limiter_2): destruction
: transformClassesAndResourcesWithProguardForRelease FAILED
23 executable tasks: 5 run, 18 up to date
]exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (psi UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.String command, System.String arguments, System.String administrator, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String arguments, System.String work directory, System.Action1 progress, System.String error)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, Task System.String, System.Action
1 progress)
Return As GradleInvokation Exception: Gradle Generation Failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, Task System.String, Progress System.Action`1)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext Context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext Context)
UnityEngine.GUIUtility: ProcessEvent (Int32, IntPtr)

c # – Unity & CSharp – Place an instanced object in the player's direction

So, I'm doing a Minecraft scam.
I have a raycast hitting a block. He then places a block inside this block. I'm trying to place it next to the block in the direction that the user is facing.

I had some of that understood. J & # 39; uses:
Math.Round ();
round the floats. My problem is which axis to round. I need it to depend on the direction the player faces to understand it.
I tried to make a complicated algorithm to determine the face of the collider that the player is facing, but it did not work very well.
enter the description of the image here

How to solve this problem? I can not understand.

Unity – Is there a better book or site (instead of documentation) to change the source code of the unreal engine?

I'm trying to change the source code of an unreal engine, but it's very complex. Is there a better book or site (instead of docs, wiki ..) to change the source code of an unreal engine?
I want something like an unreal engine code architecture (not for gameplay, but for game engine programming like the script system, the build system, the rendering engine, resource management, the cashing, etc.).

I already have knowledge of (c ++, graphical code [opengl,directx,shader code] and base of game engine architecture, game programming and graphics, etc.)

Unity – Can I redo a Call of Duty card if I change the layout so that it is not accurate?

I'm working on a multiplayer FPS game and have recreated a COD4 card that features major differences in gameplay / layout. I just do not feel comfortable without hearing someone else 's second hand. For me, it is inspired by the game but not an exact cut in the layout. Thoughts?

Our concept version version (some even changed) – A new concept invaded

Original layout – enter the description of the image here

Screenshots in-game Gallery – https://postimg.cc/gallery/n55knta2/

unity – why does GetComponent return null?

As you can see in the image below and the code, I added a class that implements the interface. ICameraControl attached to a GameObject.

When I call var controller = GetComponent();, I do not get anything (null), as in this example:

Public class KeyboardHandler: MonoBehaviour
{
private void Start ()
{
var controller = GetComponent();
if (null == controller)
print ("no ICameraControl found!");
}
}

And the output is like that in the console of the unit:

no ICameraControl found! UnityEngine.MonoBehaviour: print (Object)
Assets.Player.KeyboardHandler: Start () (at
Active / Player / KeyboardHandler.cs: 18)

Here is the Camera Position Manager attached to my game object:
enter the description of the image here

Here is the implementation of the interface:

Public class CameraPositionHandler: MonoBehaviour, ICameraControl
{
GameObject's private camera;
Quaternion private homePosition;

private void Start ()
{
mainCamera = GameObject.FindGameObjectWithTag ("MainCamera");
homePosition = mainCamera.transform.rotation;
}

private void LateUpdate () {}
}

Ideas that I'm doing wrong?

Very appreciated πŸ™‚
Mast

How to disable the input of the user after the player has made his choice (Unity, C #)?

I'm trying to create a mini-game in PvP where both players have to choose an option out of 3, but to avoid spam, I want that when a player presses a button, he stays locked until he / she 39 so that the other player can do it. his choice too.

Unity: how to imitate the lighting of a mesh as it appears in the editor view

I have a camera that shows a "bird's eye view" of a mesh generated procedurally, like this:

camera looking down on the mesh

Currently in the view of the editor (right), the pitch is exactly as I would like it. However, in the game (left), I have not managed to make it appear as I would like:

game view next to the stage

I used a directional light above, which caused the effect when the center of the mesh appears "shiny". I have therefore looked at some articles and questions on the forum and decided to instead use ambient lighting by changing the settings in Window> Render> Lighting Settings, but here is the result:

ambient lighting, mesh looks dark

This is the material that I use (EDIT: I'm using a particle shader because the staining of my meshes is based on changing mesh colors. ):

material parameters

I tried to play with different types of materials, but I could not get better results. My question is: how can I configure my game to use the same lighting as used in the editor?

Thanks in advance

Custom Button PropertyDrawer of the Unity Editor

I have a PropertyDrawer, everything goes well except one feature: I do not know how to add a button and I rather use a checkbox

Screen capture

use UnityEngine;
use UnityEditor;
using System.Collections;

[CustomPropertyDrawer (typeof (InteractiveObject))]
class InteractiveObjectPropertyDrawer: PropertyDrawer {

public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) {

EditorGUI.BeginProperty (position, label, property);
position = EditorGUI.PrefixLabel (position, GUIUtility.GetControlID (FocusType.Passive), label);
var indent = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
Rect colorRect = new Rect (position.x, position.y, 40, position.height);
Rect unitRect = new Rect (position.x + 50, position.y, 90, position.height);
Rect nameRect = new Rect (position.x + 150, position.y, position.width - 150, position.height);

EditorGUI.BeginChangeCheck ();
EditorGUI.PropertyField (colorRect, property.FindPropertyRelative ("show"), GUIContent.none);
if (EditorGUI.EndChangeCheck ()) {
RenderSettings.skybox.SetColor ("_ highlight", property.FindPropertyRelative ("id"). ColorValue);
}

EditorGUI.PropertyField (unitRect, property.FindPropertyRelative ("name"), GUIContent.none);
EditorGUI.PropertyField (nameRect, property.FindPropertyRelative ("name"), GUIContent.none);
EditorGUI.indentLevel = indent;
EditorGUI.EndProperty ();
}
}

How can I add a button there?

c # – A property defined for Unity that serializes to a string

It's a dictionary I can attach to GameObject and this is serializable since Unity can not serialize them by default.

I decided to take advantage TypeDescriptor to be able to convert any type of convertible object instead of adding many overloads such as getint, GetFloat, GetBool, GetString.

Small drawback: it is intrinsically slower since TypeDescriptor uses reflection.

I decided not to implement IDictionary for a few reasons:

  • exhibit keys the property would be confusing since the values ​​are not all chain
  • the enumerator also has little meaning unless it returns object values
  • there are many members that I will never use

It works as expected, simple and straightforward, but improvements are welcome!

using the system;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using JetBrains.Annotations;
use UnityEngine;

namespace ZeroAG.Scene
{
    [SuppressMessage("ReSharper", "IdentifierTypo")]
    Public class PropertySet: MonoBehaviour, IPropertySet, ISerializationCallbackReceiver
{
internal const string DictionaryKeysProperty = nameof (_dictionaryKeys);
internal const String DictionaryValsProperty = nameof (_dictionaryVals);

Private dictionary _dictionary = new dictionary();

        [SerializeField]
        [HideInInspector]
        
        
        
        private list _dictionaryKeys = new list();

        [SerializeField]
        [HideInInspector]
        
        
        
        private list _dictionaryVals = new list();

#region IPropertySet Members

empty public Clear ()
{
_dictionary.Clear ();
}

public bool ContainsKey (string key)
{
if (key == null)
throws new ArgumentNullException (nameof (key));

return _dictionary.ContainsKey (key);
}

public T GetValue(chain key)
{
if (key == null)
throws new ArgumentNullException (nameof (key));

converter var = TypeDescriptor.GetConverter (typeof (T));

if (! converter.CanConvertFrom (typeof (string)))
throws a new exception InvalidCastException ($ "Unable to convert from {typeof (string)} to {typeof (T)}.");

var value = _dictionary[key];

var o = converter.ConvertFromInvariantString (value);
if (o is T result)
return the result;

throws new InvalidCastException ($ "The converted value is not of type {typeof (T)}.");
}

public bool Remove (string)
{
if (key == null)
throws new ArgumentNullException (nameof (key));

return _dictionary.Remove (key);
}

public null SetValue(string key, T value)
{
if (key == null)
throws new ArgumentNullException (nameof (key));

if (value == null)
throws new ArgumentNullException (nameof (value));

converter var = TypeDescriptor.GetConverter (typeof (T));

if (! converter.CanConvertTo (typeof (string)))
launches new InvalidOperationException ($ "Unable to convert from {typeof (T)} to {typeof (string)}.");

var result = converter.ConvertToInvariantString (value);

AddOrUpdate (key, result);
}

public bool TryGetValue(string key, T result)
{
if (key == null)
throws new ArgumentNullException (nameof (key));

try
{
result = GetValue(key);
return true;
}
capture
{
result = default (T);
returns false;
}
}

#endregion

#region ISerializationCallbackReceiver Members

void ISerializationCallbackReceiver.OnAfterDeserialize ()
{
_dictionary = _dictionaryKeys.Zip (_dictionaryVals, (k, v) => new {k, v}). ToDictionary (s => s.k, s => s.v);
}

void ISerializationCallbackReceiver.OnBeforeSerialize ()
{
_dictionaryKeys = _dictionary.Keys.ToList ();
_dictionaryVals = _dictionary.Values.ToList ();
}

#endregion

private void AddOrUpdate ([NotNull] string key, string value)
{
if (key == null)
throws new ArgumentNullException (nameof (key));

if (_dictionary.ContainsKey (key))
{
_dictionary[key] = value;
}
other
{
_dictionary.Add (key, value);
}
}
}
}