Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Trying to run basic mono script, add input to it?

Discussion in 'Visual Scripting' started by aCake0202, Mar 15, 2021.

  1. aCake0202

    aCake0202

    Joined:
    Mar 11, 2021
    Posts:
    26
    I'm very new to bolt, unity and programming in general. I've made a bolt script that check if the current object is the player and I've got it working. I got a C# script online that resets the level, but the script doesn't have an input. How can I add an input to this script so that the script runs when activated?

    upload_2021-3-15_0-27-39.png


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Restart : MonoBehaviour
    6. {
    7.     // Start is called before the first frame update
    8.     void Start()
    9.     {
    10.        
    11.     }
    12.  
    13.     // Update is called once per frame
    14.     void Update()
    15.     {
    16.         {
    17.            
    18.          Application.LoadLevel (Application.loadedLevel);
    19.               }
    20.     }
    21. }
    22.