标签:#Unity

Posts

· 2019-04-12 · * Unity *

Simple class for executing Coroutine easily


using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;



public class CoroutineExecutor : MonoBehaviour
{

    public System.Action DoneCallback;
· 2019-04-11 · * Unity *

My Unity Plugin published: Asset Checker

1. This tool is developed for checking assets in game project with error or not best practice importing settings

2. Currently Checked Assets Type

  • Texture2D
    • Texture file size
    • Dimensions
    • Read/Write enable
    • Generate mipmap enable
  • AudioClip
    • Large audioclip using Streaming loadtype
    • Force mono
  • Font
· 2019-04-06 · * Unity *

From Scale around points similar to rotate around


    public static void ScaleAround(Transform target, Vector3 pivot, Vector3 newScale)
    {
        Vector3 A = target.localPosition;
        Vector3 B = pivot;

        Vector3 C = A - B; // diff from object pivot to desired pivot/origin

        float RS = newScale.x / target.localScale.x; // relative scale factor

        // calc final position post-scale
· 2019-04-01 · * Unity *

Find references in Assets:


[MenuItem("Assets/Find Refereces")]
public static void FindReferences()
{
    EditorSettings.serializationMode = SerializationMode.ForceText;
    string path = AssetDatabase.GetAssetPath(Selection.activeObject);
    if (!string.IsNullOrEmpty(path))
    {
        string guid = AssetDatabase.AssetPathToGUID(path);
        List<string> withoutExtensions = new List<string>() {".prefab", ".unity", ".mat", ".asset"};
        string[] files = Directory.GetFiles(Application.dataPath, "*.*", SearchOption.AllDirectories)
· 2019-03-11 · * Unity *

EventTriggerListener


using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;

public class EventTriggerListener : MonoBehaviour, IPointerClickHandler, IPointerDownHandler, IPointerEnterHandler,
    IPointerExitHandler, IPointerUpHandler, IDragHandler
{
    public delegate void VoidDelegate1(GameObject go, PointerEventData eventData);
· 2019-03-10 · * Unity *

Singleton from https://www.suntabu.com/page/?d=1512300646985



using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Assertions;
using UnityToolbag.Singleton;

public class ResourcesManager : Singleton<ResourcesManager>
{
    private ResourcesManager()
· 2019-03-10 · * Unity *

ResourcesManager from https://www.suntabu.com/page.html?d=1552226655668


using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.Assertions;

public class AudioManager : MonoBehaviour
{
    /// <summary>
    /// cached audiosource componets list. 
· 2019-01-21 · * Unity *

From https://stackoverflow.com/questions/566462/upload-files-with-httpwebrequest-multipart-form-data

 public static void HttpUploadFile(string url, string file, string paramName, string contentType,
        NameValueCollection nvc)
    {
        Debug.Log(string.Format("Uploading {0} to {1}", file, url));
        string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
        byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

        HttpWebRequest wr = (HttpWebRequest) WebRequest.Create(url);
        wr.ContentType = "multipart/form-data; boundary=" + boundary;
        wr.Method = "POST";
· 2019-01-12 · * Unity *

Graphy is a tool which won Unity 2018 Rewards - Best development tool.

The Debugger:

this component is a powerful feature that allows you to set a number of conditions, that, if met, will start a chain of actions defined by you. It's designed around Debug Packets. Each Debug Packet can have different conditions and actions.

  • Common parameters:
    • Active: If not active, it will be skipped when the debugger checks Debug
      Packets.
    • ID: Optional, but it’s used to operate with Debug Packets from code.
    • Execute once: If true it will only be executed once, then it will delete itself.
    • Init sleep time: Time to wait before checking this Debug Packet.
    • Sleep time after execute: Only applies if “Execute Once” is false. Time to
      wait before checking this Debug Packet after it’s been executed.
· 2018-12-28 · * Unity *
SphericalCoordinate
using System;
using UnityEngine;

namespace UnityToolbag.CoordinateSystems.SphericalCoordinate
{
    public class SphericalCoordinateSystem
    {

        public static SphericalCoordinate FromCartesian(Vector3 v)
        {