Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Random Direction#

Random / Random Direction

  • Can Read

  • Cannot Write

Description#

A random unit length direction pointing anywhere around a circle

Code#

using System;
using UnityEngine;
using VisualScript.Icons;
using Random = UnityEngine.Random;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Random Direction")]
    [Category("Random/Direction")]

    [Description("A random unit length direction pointing anywhere around a circle")]
    [Image(typeof(IconDice), ColorTheme.Type.Yellow, typeof(BadgeArrowRight))]

    [Keywords("Dice", "Vector", "Angle", "Normalized", "Unit", "Any", "Circle")]

    [Serializable]
    public class TypeVector2RandomDirection : TypeVector2
    {
        public override Vector2 Get(Args args)
        {
            return Random.insideUnitCircle.normalized;
        }

        public override string ToString()
        {
            return "Random Direction";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnUpdate;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.