- How to load new scripts?
- Compile MOD project DLL and load the Assembly during runtime in the original project (done by ModTool)
- How to ensure the loaded code is secure?
- Using Mono.Cecil (an official Unity package exists for that), we can limit the access to certain methods/APIs (done by ModTool)
- How to use the original project code? (inherit from an existing classes, use existing components, etc...)
- Export the project DLL (and its dependencies) in an .unitypackage file to import in the MOD project (done by ModTool)
- TODO: Original project code should be under an assembly definition file and the needed DLL referenced by the ASMDEF should be included in the .unitypackage?
- How to make sure the Unity settings for the MOD corresponds to the one of the original project?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class TargetFPS : MonoBehaviour | |
{ | |
[SerializeField] private int _targetFramerateValue = 60; | |
void Awake() | |
{ | |
Application.targetFrameRate = _targetFramerateValue; | |
QualitySettings.vSyncCount = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using UnityEngine; | |
[RequireComponent(typeof(Camera))] | |
public class CameraScreenshot : MonoBehaviour | |
{ | |
[SerializeField] private RenderTexture _outputTexture = null; | |
[SerializeField] private KeyCode _key = KeyCode.Space; | |
[SerializeField] private string _path = string.Empty; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.IO; | |
using UnityEditor; | |
using UnityEditor.SceneManagement; | |
using UnityEngine; | |
class SceneWindow : EditorWindow | |
{ | |
[MenuItem("Window/Scenes")] | |
public static void ShowWindow() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class DragObject2D : MonoBehaviour | |
{ | |
public float dampingRatio = 0.5f; | |
public float frequency = 5f; | |
private TargetJoint2D targetJoint; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let messageOptions = { | |
persistent: true, | |
expiration: 5000, | |
priority: 10 | |
}; | |
var queues = { | |
INCOMING_MESSAGE_QUEUE: { name: 'incomming_message', options: { durable: true }, exchange: 'incomming-message-exchange', routing: 'incomming-message-routing' }, | |
INCOMING_MESSAGE_DLX_QUEUE: { | |
name: 'incomming_message_dlx', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Xna.Framework; | |
using Microsoft.Xna.Framework.Graphics; | |
using MonoGame.Extended.BitmapFonts; | |
using MonoGame.Extended.ViewportAdapters; | |
namespace Demo.ViewportAdapters | |
{ | |
public class Game1 : Game | |
{ | |
private GraphicsDeviceManager _graphics; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup the Java references. | |
ovrJava java; | |
auto jniEnv = (JNIEnv*)SDL_AndroidGetJNIEnv(); | |
JavaVM* javaVm; | |
jniEnv->GetJavaVM(&javaVm); | |
auto activity = (jobject)SDL_AndroidGetActivity(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mat src(height, width, CV_8UC4, const_cast<unsigned char*>(imageData.data())); | |
Mat src_gray, hsv, final; | |
// Create the final image to display | |
cvtColor(src, final, CV_BGRA2RGBA); | |
// Remove useless alpha canal | |
cvtColor(src, src, CV_BGRA2BGR); | |
// Convert image to HSV |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void proccessImage(std::vector<unsigned char>& imageData, int width, int height) | |
{ | |
Mat src(width, height, CV_8UC4, const_cast<unsigned char*>(imageData.data())); | |
Mat src_gray, final; | |
// Convert the source image to gray | |
cvtColor(src, src_gray, CV_BGRA2GRAY); | |
// Apply gaussian blur on the gray image | |
GaussianBlur(src_gray, src_gray, cv::Size(9, 9), 2, 2); |
NewerOlder