Change var of parent

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By exe2k

I have a scene “Interactive” and Inherited scene “PowerBox”
Each has a script:

#Interactive (PARENT)

extends Node

var activated 

func set_active(num):
     activated = num
     print(activated)

Script in child:

#Powebox (CHILD)
 extends "res://Scripts/Interactive.gd"
set_active(2)

The result is Null.

:bust_in_silhouette: Reply From: TyTYctA

Function set_active will not be called directly at script. You need to put it to other function.

#Powebox (CHILD)
 extends "res://Scripts/Interactive.gd"

func _ready():
    set_active(2)

this function called from a parent script by Input event.

exe2k | 2019-03-18 12:23

Can you share all script?

TyTYctA | 2019-03-18 12:25