[ Web Proxy ]
URL:
Viewing: https://docs.unity3d.com/ScriptReference/Vector2-operator_float2.html [Back]  [Original]

Unity - Scripting API: Vector2.Vector2
Version: Unity 6.5 (6000.5)
    • Supported
    • Legacy
    LanguageEnglish
    • C#

    Vector2.Vector2

    Suggest a change

    Success!

    Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

    Close

    Submission failed

    For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

    Close
    Your name Your email Suggestion* Submit suggestion

    Cancel

    Parameters

    Parameter Description
    v The float2 to be converted to a Vector2.

    Returns

    Vector2 The converted Vector2 result.

    Description

    Converts a float2 to a Vector2.

    An implicit conversion operator that converts an input float2 value to a Vector2.

    // Attach this script to a GameObject.
    using UnityEngine;
    using Unity.Mathematics; // brings in float2

    public class Example_Vector2_FromFloat2 : MonoBehaviour { void Start() { float2 a = new float2(4f, 5f); Debug.Log("Input float2 is: " + a.ToString());

    // Implicit conversion from Unity.Mathematics.float2 to UnityEngine.Vector2 Vector2 result = a; Debug.Log("Result Vector2 is: " + result.ToString()); } }

    Web Proxy Viewer  |  New URL  |  Original Page