Skip to content

Commit

Permalink
New Input System no longer requires any manual modifications (Package…
Browse files Browse the repository at this point in the history
… Manager friendly)
  • Loading branch information
yasirkula committed Sep 30, 2023
1 parent df526e8 commit b497719
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ There are 5 ways to install this plugin:
- *(via [OpenUPM](https://openupm.com))* after installing [openupm-cli](https://github.com/openupm/openupm-cli), run the following command:
- `openupm add com.yasirkula.imagecropper`

## FAQ

- **New Input System isn't supported on Unity 2019.2.5 or earlier**

Add `ENABLE_INPUT_SYSTEM` compiler directive to **Player Settings/Scripting Define Symbols** (these symbols are platform specific, so if you change the active platform later, you'll have to add the compiler directive again).

- **"Unity.InputSystem" assembly can't be resolved on Unity 2018.4 or earlier**

Remove `Unity.InputSystem` assembly from **ImageCropper.Runtime** Assembly Definition File's *Assembly Definition References* list.

## HOW TO

ImageCropper is a singleton object that can be accessed via `ImageCropper.Instance`. To start cropping a *Texture* object, you can call the following function:
Expand Down
7 changes: 5 additions & 2 deletions Plugins/ImageCropper/ImageCropper.Runtime.asmdef
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"name": "ImageCropper.Runtime"
}
"name": "ImageCropper.Runtime",
"references": [
"Unity.InputSystem"
]
}
Binary file removed Plugins/ImageCropper/README.pdf
Binary file not shown.
6 changes: 6 additions & 0 deletions Plugins/ImageCropper/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
= Image Cropper (v1.0.7) =

Documentation: https://github.com/yasirkula/UnityImageCropper
FAQ: https://github.com/yasirkula/UnityImageCropper#faq
Example code: https://github.com/yasirkula/UnityImageCropper#example-code
E-mail: [email protected]

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Plugins/ImageCropper/Scripts/EventSystemHandler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
using UnityEngine.InputSystem.UI;
#endif

namespace ImageCropperNamespace
{
Expand All @@ -13,6 +16,18 @@ public class EventSystemHandler : MonoBehaviour
private GameObject embeddedEventSystem;
#pragma warning restore 0649

#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
private void Awake()
{
StandaloneInputModule legacyInputModule = embeddedEventSystem.GetComponent<StandaloneInputModule>();
if( legacyInputModule )
{
DestroyImmediate( legacyInputModule );
embeddedEventSystem.AddComponent<InputSystemUIInputModule>();
}
}
#endif

private void OnEnable()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.yasirkula.imagecropper",
"displayName": "Image Cropper",
"version": "1.0.6",
"version": "1.0.7",
"documentationUrl": "https://github.com/yasirkula/UnityImageCropper",
"changelogUrl": "https://github.com/yasirkula/UnityImageCropper/releases",
"licensesUrl": "https://github.com/yasirkula/UnityImageCropper/blob/master/LICENSE.txt",
Expand Down

0 comments on commit b497719

Please sign in to comment.