该对象将不会显示在层次结构中,并且在从MonoBehaviour派生的其他脚本中,调用GameObject.Find(“ / Canvas”)将为空。
//function that returns closure to be used as one of parallel jobs
def buildSingleJobParallel(steps, mjob){
return {
def result = steps.build job: mjob.fullName, propagate: false
steps.echo "${mjob.fullName} finished: ${steps.result.rawBuild.result}"
if (result.rawBuild.result.isWorseThan(Result.SUCCESS)) {
steps.currentBuild.result = 'FAILURE'
}
}
}
stage('Integration Test Run') {
steps {
script {
//build map<jobName, Closure> and run jobs in parallel
parallel matchingJobs.collectEntries{mjob-> [mjob.name, buildSingleJobParallel(this, mjob)]}
}
}
}
答案 0 :(得分:0)
那是因为我改变了场景。我应该添加
DontDestroyOnLoad(canvas);
之后
canvas = GameObject.Find("/Canvas") ?? new GameObject("Canvas");