====== 自動で装着してエフェクトを出す ====== 手をかざすと自動で付着して、5秒後に離れるVCIです。\\ 装着中はエフェクトが再生されます。 === UnityPackage === {{ :vci:script:reference:attachsample.zip |}} {{:vci:script:reference:2020041612403245.jpg?400|}} ===== VCIスクリプト ===== local item = vci.assets.GetTransform("Ball") local effect = vci.assets.GetEffekseerEmitter("Ball") vci.StartCoroutine( coroutine.create( function() while true do if item.IsAttached == false then item.AttachToAvatar() sleep(0.1) if item.IsAttached then effect.Play() sleep(5) item.DetachFromAvatar() effect.Stop() sleep(1) end end sleep(0.5) end end ) ) function sleep(sec) local t0 = os.time() + sec while os.time() < t0 do coroutine.yield() end end