Spawning a projectile and trying to set its parent to another spawned assets returns an error:
local obj1 = script:GetCustomProperty("template1")
local obj2 = script:GetCustomProperty("template2")
local parentObj = World.SpawnAsset(obj2)
local projectileObj = Projectile.Spawn(obj1,script.parent:GetPosition(),Vector3.New(1,0,0))
projectileObj.parent = parentObj
- attempt to index (set) nil value "parent" on Projectile (bad (misspelled?) key name or does not exist)
The core documentation shows it should at least be possible with two non-projectiles:
local propCubeTemplate = script:GetCustomProperty("CubeTemplate")
local cube1 = World.SpawnAsset(propCubeTemplate)
local cube2 = World.SpawnAsset(propCubeTemplate)
cube2.parent = cube1