| 更新: | 2026-01-17 |
|---|---|
| 作者: | @voluntas |
| バージョン: | 2026.1 |
| URL: | https://voluntas.github.io/ |
typo などは https://x.com/voluntas までご連絡ください。
| 更新: | 2026-01-17 |
|---|---|
| 作者: | @voluntas |
| バージョン: | 2026.1 |
| URL: | https://voluntas.github.io/ |
typo などは https://x.com/voluntas までご連絡ください。
| //Copyright (c) 2014 Tilman Schmidt (@KeyMaster_) | |
| //Permission is hereby granted, free of charge, to any person obtaining a copy | |
| //of this software and associated documentation files (the "Software"), to deal | |
| //in the Software without restriction, including without limitation the rights | |
| //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| //copies of the Software, and to permit persons to whom the Software is | |
| //furnished to do so, subject to the following conditions: | |
| //The above copyright notice and this permission notice shall be included in |
| // Drop into Assets/Editor, use "Tools/Regenerate asset GUIDs" | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.IO; | |
| using UnityEditor; | |
| namespace UnityGuidRegenerator { | |
| public class UnityGuidRegeneratorMenu { |
| using UnityEngine; | |
| using System.Collections; | |
| public static class Vibration | |
| { | |
| #if UNITY_ANDROID && !UNITY_EDITOR | |
| public static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); | |
| public static AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"); | |
| public static AndroidJavaObject vibrator = currentActivity.Call<AndroidJavaObject>("getSystemService", "vibrator"); |
| /*** | |
| * This script will anchor a GameObject to a relative screen position. | |
| * This script is intended to be used with ViewportHandler.cs by Marcel Căşvan, available here: http://gamedev.stackexchange.com/a/89973/50623 | |
| * It is also copied in this gist below. | |
| * | |
| * Note: For performance reasons it's currently assumed that the game resolution will not change after the game starts. | |
| * You could not make this assumption by periodically calling UpdateAnchor() in the Update() function or a coroutine, but is left as an exercise to the reader. | |
| */ | |
| /* The MIT License (MIT) |
| #ifndef NOISE_SIMPLEX_FUNC | |
| #define NOISE_SIMPLEX_FUNC | |
| /* | |
| Description: | |
| Array- and textureless CgFx/HLSL 2D, 3D and 4D simplex noise functions. | |
| a.k.a. simplified and optimized Perlin noise. | |
| The functions have very good performance | |
| and no dependencies on external data. |
Some code allocates memory when running in the editor and not on the device. This is due to Unity doing some extra error handling so possible error messages can be output in the console. Much of this code is stripped during build. It's therefore important to profile on device, and do it regularly.
Optimizations often makes code more rigid and harder to reason. Don't do it until you really need to.
When profiling, wrap methods or portions of a method in Profiler.BeginSample(string name) and Profiler.EndSample() to make them easier to find in the profiler.
public class SomeClass {| using UnityEngine; | |
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Threading; | |
| class BitmapEncoder | |
| { | |
| public static void WriteBitmap(Stream stream, int width, int height, byte[] imageData) |
| using UnityEngine; | |
| using UnityEngine.Networking; | |
| using UnityEditor; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Security.Cryptography; | |
| using System.Text; | |
| using System; |
| using UnityEngine; | |
| using System.Collections; | |
| public class FlyCamera : MonoBehaviour { | |
| /* | |
| Writen by Windexglow 11-13-10. Use it, edit it, steal it I don't care. | |
| Converted to C# 27-02-13 - no credit wanted. | |
| Simple flycam I made, since I couldn't find any others made public. | |
| Made simple to use (drag and drop, done) for regular keyboard layout |