コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】【Airtest IDE】【Poco】ゲームオブジェクトのパラメータを参照する方法

概要

f:id:baba_s:20181003205609p:plain

「Airtest IDE」の「Poco Assistant」でゲームオブジェクトを選択することで
そのゲームオブジェクトのパラメータを参照することができます

# -*- encoding=utf8 -*-
from poco.drivers.unity3d import UnityPoco
poco = UnityPoco()

button = poco('StartButton')

print(button.attr('type'))
print(button.attr('name'))
print(button.attr('visible'))
print(button.attr('pos'))
print(button.attr('size'))
print(button.attr('scale'))
print(button.attr('anchorPoint'))
print(button.attr('zOrders'))
print(button.attr('clickable'))
print(button.attr('components'))
print(button.attr('texture'))
print(button.attr('_instanceId'))

スクリプトから参照したい場合は、attr 関数を使用して引数にプロパティ名を指定します

f:id:baba_s:20181003205805p:plain

ログ出力すると、このようにパラメータが取得できていることがわかります