I want to know under what conditions this error occurs in Verse.

LogVerse: Error: VerseRuntimeErrors: Verse unrecoverable error: ErrRuntime_InvalidVarRead: Attempted to read a var out of an invalid object.

When this happens, Verse will crash and stop working.

hi @Fortnigtht ,
My guess is that the var has not been assigned a value.

var MyValue : int    #would fail with runtime error invalid object referenced

var MyValue : int   =  0  # will work aa a value has been set

The  value could be set by by the by assignment

var MyValue : int  
set MyValue = 0






If it was a constant this would fail in compile as the strong checks of the compiler

This is the problematic function indicated by the error statement. No problems have been found so far.

LogVerse: Error: VerseRuntimeErrors: Verse unrecoverable error: ErrRuntime_InvalidVarRead: Attempted to read a var out of an invalid object.
Truncated callstack follows:
task_GameManager$GenarateUIStart(:Generation,:agent,:GenerateChairData):Update (Unknown source) (Source: Unknown(0,0, 0,0))

GenarateUIStart(Generator : Generation,Agent : agent,SeatData : GenerateChairData)<suspends>:void=
        Print("GenerateStart",?Color := NamedColors.Yellow)
        if(set PlayerDatas[Agent].PlayerState = State.Generate):
        var EventCount : int = 0
        var CheckNow : logic = false
        GenerateSound.Play(Agent)
        race:
            loop:
                Ag := MoveXCheck.PressedEvent.Await()
                if(Ag = Agent){break}
            loop:
                Ag := MoveYCheck.PressedEvent.Await()
                if(Ag = Agent){break}
            loop:
                Ag := JumpCheck.PressedEvent.Await()
                if(Ag = Agent){break}
            loop:
                Sleep(0.1)
                Generator.AddEnergy(0.18)
                Size := (Generator.NowEnergy/100.0)
                if(not Generator.IsGenerated[]):
                    VarUpdate(Agent,Size)
            loop:
                Sleep(GetRandomFloat(7.0,13.0))
                if(SK := SkillCheck[GetRandomInt(0,SkillCheck.Length - 1)]):
                    if(Movie := SK.Cinema[PlayerDatas[Agent].PlayerNumber]):
                        Movie.Play(Agent)
                        set CheckNow = true
                        NowTime := GetSimulationElapsedTime()
                        race:
                            loop:
                                Ag := ShotCheck.PressedEvent.Await()
                                if(Ag = Agent):
                                    break
                            Movie.StoppedEvent.Await()
                        Movie.Stop(Agent)
                        Difference := Abs(GetSimulationElapsedTime() - NowTime - SK.ActiveFrame*(1.0/30.0))
                        if(Difference <= 0.06):
                            Generator.AddEnergy(1.0)
                            Print("Great")
                            GreatSound.Play(Agent)
                        else if(Difference <= 0.15):
                            Print("OK")
                            OKSound.Play(Agent)
                        else:
                            Print("Miss")
                            MissSound.Play(Agent)
                            if(FortChar := Agent.GetFortCharacter[],FortChar.IsActive[],Generator.EffectPos.IsValid[]):
                                Angele := ReturnTan(Generator.EffectPos.GetTransform(),FortChar.GetTransform())
                                var PosIn : transform = Generator.EffectPos.GetTransform()
                                set PosIn.Rotation = MakeRotationFromYawPitchRollDegrees(Angele,0.0,0.0)
                                Generator.AddEnergy(-5.0)
                                Prop := SpawnProp(MissEffect,PosIn)(0)
                                if(p := Prop?):
                                    spawn{DeleteDelay(p,3.0)}
                                break
                        Print("Diffence = {Difference}")
                        set CheckNow = false
                    
            loop:
                Generator.Shake()
                Sleep(1.0)
            loop:
                Ag := DamageEvent.Await()
                if(Ag = Agent):
                    break
            Generator.SuccsessEvent.Await()
        if(not Generator.IsGenerated[]):
            SeatData.Button.Enable()
        if(CheckNow = true and not Generator.IsGenerated[]):
            MissSound.Play(Agent)
            if(FortChar := Agent.GetFortCharacter[],FortChar.IsActive[],Generator.EffectPos.IsValid[]):
                Angele := ReturnTan(Generator.EffectPos.GetTransform(),FortChar.GetTransform())
                var Pos : transform = Generator.EffectPos.GetTransform()
                set Pos.Rotation = MakeRotationFromYawPitchRollDegrees(Angele,0.0,0.0)
                Generator.AddEnergy(-5.0)
                Prop := SpawnProp(MissEffect,Pos)(0)
                if(p := Prop?):
                    spawn{DeleteDelay(p,3.0)}
        for(SK : SkillCheck):
            if(Movie := SK.Cinema[PlayerDatas[Agent].PlayerNumber]):
                Movie.Stop(Agent)
        GenerateSound.Stop(Agent)
        if(Chair := PlayerDatas[Agent].SeatChair?):
            Chair.Eject(Agent)
        VarHide(Agent)
        if(set PlayerDatas[Agent].SeatChair = false):
        Print("GenerateEnd",?Color := NamedColors.Yellow)
        if(PlayerDatas[Agent].PlayerHealth >= 1.0):
            if(set PlayerDatas[Agent].PlayerState = State.Free):
                Print("Free")
        return

hi @Fortnigtht ,
This is speculation .The only lines that matches the error log

                                Angele := ReturnTan(Generator.EffectPos.GetTransform(),FortChar.GetTransform())
                              
                                set PosIn.Rotation = MakeRotationFromYawPitchRollDegrees(Angele,0.0,0.0)

Angele according to output log is 0

MakeRotationFromYawPitchRollDegrees(Angele,0.0,0.0)

Source: Unknown(0,0, 0,0))
matches
The real value would be found by putting Log.Print statement after the assignment and look in the Fortnite log window while running.

Put a Log.Print for the PosIn.Rotation and check the value.
Possibly this wont print because of the runtime error.
Just the usual tedious Print statements until the error is found.

Dont have any more ideas

ReturnTan has “transacts”. Could this be the problem?

ReturnTan(T1 : transform,T2 : transform)<transacts>:float=
        Angle := ArcTan(T2.Translation.Y - T1.Translation.Y,T2.Translation.X - T1.Translation.X)*180/PiFloat
        return Angle

According to the manual linked above your code is by default fully described as

<transacts><no_rollback> #only allowed in UEFN API 

So if there is an error there is no fallback on error so you will need

<decides><transacts>

Trying control-f to search with transacts

they all say

<decides><transacts>

There may be an error in your code which will now show up