Skip to content

prostolyubo/unity-webgl-copy-and-paste

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity WebGL Copy and Paste

For some reason Unity decided not to support copy and paste in WebGL. Here is an attempt to add it back in. No promises that it's perfect 😅

screenshot

At the moment there is only support for InputField and TMPro.TMP_InputField

Example: https://greggman.github.io/unity-webgl-copy-and-paste/

Instructions

  1. Download and add in this unity package into your project.

  2. Make a GameObject and add in the WebGLCopyAndPaste script.

  3. If you are using TMPro.TMP_InputField then edit Assets/WebGLCopyAndPaste/Scripts/WebGLCopyAndPaste.cs and uncomment this line

// #define WEBGL_COPY_AND_PASTE_SUPPORT_TEXTMESH_PRO

Alternatives

This might be better?

https://github.com/kou-yeung/WebGLInput

Issues

  • Non Alphabetic characters

    See this thread. You apparently need to include the fonts in your Unity project.

  • Ctrl-A/⌘-A selects other HTML on the page

    1. Make your own WebGL template that doesn't have anything to select. Maybe this one though I didn't try it.

    2. Make your own WebGL template and use user-select: none; in your CSS to make whatever parts of the page you want to prevent from being selected.

ChangeList

  • 0.0.2

    • Support cut

    • Support Safari

  • 0.0.1

    • Initial Release

License: BSD-3-Clause

About

Support Copy and Paste in Unity WebGL

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%