|
- local blinkSymbolImage = blinkSymbolObject:AddComponent(typeof(CS.UnityEngine.UI.Image)) --泛型-typeof
- blinkSymbolImage.sprite = self:getSlotsCacheSymbolsSpriteData(symbolsObjectData[i]:getSymbolName()); --self.sprite;
- local rectTransform=blinkSymbolObject:GetComponent("RectTransform");
- rectTransform.sizeDelta = { x = blinkSymbolImage.mainTexture.width, y = blinkSymbolImage.mainTexture.height };
复制代码 通过sizeDelta 来设置,如果用unity自带的打包工具,需改为:- blinkSymbolImage:SetNativeSize();
- rectTransform.sizeDelta = { x = rectTransform.sizeDelta.x * 100, y = rectTransform.sizeDelta.y * 100 };
复制代码 blinkSymbolImage:SetNativeSize的方法
|
|