Beispiel #1
0
        public Sprite2D RayHitSprite()
        {
            Sprite2D   target = null;
            Ray        ray    = mainCamera.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                target = hit.collider.gameObject.GetComponent <Sprite2D>();
            }
            return(target);
        }
Beispiel #2
0
        public override void OnInspectorGUI()
        {
            Sprite2D sprite = (Sprite2D)target;

            sprite.UpdateTransform();
            sprite.UpdateSize();
            sprite.position = EditorGUILayout.Vector3Field("位 置", sprite.position);
            sprite.size     = EditorGUILayout.Vector2Field("尺 寸", sprite.size);
            sprite.alpha    = EditorGUILayout.Slider("透明度", sprite.alpha, 0.0f, 1.0f);

            sprite.udata = EditorGUILayout.TextField("用户数据", sprite.udata);
        }