An't add functions to XR Grab Interactable under interactable events

So basically the code is for a football game that I’m making in VR, and I’m trying to make the ball act realistic when thrown. so basically the ball will spiral and the nose of the ball will change its direction based on face velocity. and im trying to make it so when its thrown, it will start the start functions in my script, and when its not being held then it will start the stop functions in my script. Im going based off this video so hopefully this helps you understand what im talking about -XR Toolkit - Basic Programming [01] by Andrew

Here is my script too

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Security.Cryptography;
using UnityEngine;



public class Spin : MonoBehaviour
{
    float spin;
    float spinspeed;
    Vector3 facing;
    Rigidbody rb;
    private bool CanStartVelocity = false;
    private bool CanStartSpin = false;
    // Use this for initialization
    void Start()
    {
        rb = GetComponent<Rigidbody>();
        StopFaceVelocity();
        StopcanSpin();
    }



    // Update is called once per frame
    void Update()
    {

    }

    public void StartcanSpin()
    {
        if (CanStartSpin = true)
        {
            StartcanSpin() = true;
            spin = 1f;
            spinspeed = 20f;
        }
    }

   public void StartFaceVelocity()
    {
        if(CanStartVelocity = true)
        {
            StartFaceVelocity() = true;
            facing = Quaternion.LookRotation(rb.velocity).eulerAngles;
            spin += Time.deltaTime * spinspeed;
            if (spin > 360f) { spin = spin - 360f; }
            transform.eulerAngles = new Vector3(facing.x, spin, facing.z);
        }
    }

    public void StopFaceVelocity()
    {
       if(CanStartVelocity = false)
        {
            FaceVelocity() = false;
        }
    }

    public void StopcanSpin()
    {
        if(CanStartSpin = false)
        {
            StartcanSpin() = false;
        }
    }

} 

Also if you find anything else with the script that is wrong, please tell me. Because its giving a lot of errors which is forcing me to enter safe mode. Thank you!

Hello,

In all of your if statements you are using the “=” symbol which is used to declare a value for a variable e.g:

float value = 2.0f;
bool isGrounded = true;

In if statements use “==” symbol instead as you are saying: This variable should have this value then run this code.

In your case you are saying this variable has this value, or in other words “declaring” it in the if statement.

Just change all single “=” symbols into “==” symbol and it’ll fix the issue.

Please note that entering Safe Mode is optional but recommended, it’s prompted whenever there are compiler errors upon opening the project and you can always ignore the prompt and the project will open as usual.

Also note that the warning in the console from your screenshot actually gave a hint regarding this:

Also there is completely no reason for you to call the same function in itself, it won’t work and will throw an error:

public void StartcanSpin()
    {
        if (CanStartSpin = true)
        {
            StartcanSpin() = true;
            spin = 1f;
            spinspeed = 20f;
        }
    }

Your code is pretty confusing and I would recommend going through Unity Learn Pathways, to get a a bit experience in coding I would recommend going through this one: Abstraction in object-oriented programming - Unity Learn

But I highly recommend going through the whole Pathway of Junior Programmer, it would help you immensly.