Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HELP ME... #6

Closed
truongson-devgame opened this issue Sep 19, 2016 · 9 comments
Closed

HELP ME... #6

truongson-devgame opened this issue Sep 19, 2016 · 9 comments

Comments

@truongson-devgame
Copy link

.
When i use your plugin. I got error:
Trying to remove myImage (UnityEngine.UI.Image) from rebuild list while we are already inside a rebuild loop. This is not supported.
UnityEngine.GameObject:SetActive(Boolean)
MyClass:ScrollCellIndex(Int32)
UnityEngine.UI.LoopScrollRect:LateUpdate()

how to fix this, please..

@qiankanglai
Copy link
Owner

would you mind post an example?

@truongson-devgame
Copy link
Author

This is myclass:
using System.Collections;
using UnityEngine.UI;
using UnityEngine;

public class TableBehavior : MonoBehaviour {
//UI
[SerializeField]
Text lb_tenban;
[SerializeField]
Text lb_muccuoc, lb_can;
[SerializeField]
Slider slide_tinhtrang;
[SerializeField]
Slider slide_tinhtrang_XocDia;
[SerializeField]
Text numPlayer;
[SerializeField]
Image spriteLock;
[SerializeField]
Image backgroundSprite;
[SerializeField]
Color[] color;
TableItem tableItem;

void ScrollCellIndex(int index) {
    this.tableItem = GameControl.instance.listTable[index];
    if (index % 2 == 0) {
        backgroundSprite.color = color[0];
    } else {
        backgroundSprite.color = color[1];
    }
    lb_tenban.text = "Bàn " + tableItem.id;
    lb_muccuoc.text = BaseInfo.formatMoneyNormal(tableItem.money) + " " + Res.MONEY_FREE;
    lb_can.text = BaseInfo.formatMoneyNormal(tableItem.needMoney) + " " + Res.MONEY_FREE;

     bool isLock = tableItem.isLock == 1 ? true : false;
    spriteLock.gameObject.SetActive(isLock);

}

}

@qiankanglai
Copy link
Owner

Hi, I've tried your script and works fine...Unity 5.3.6

public class ScrollIndexCallback1 : MonoBehaviour
{
    //UI
    [SerializeField]
    Text lb_tenban;
    [SerializeField]
    Text lb_muccuoc, lb_can;
    [SerializeField]
    Slider slide_tinhtrang;
    [SerializeField]
    Slider slide_tinhtrang_XocDia;
    [SerializeField]
    Text numPlayer;
    [SerializeField]
    Image spriteLock;
    [SerializeField]
    Image backgroundSprite;
    [SerializeField]
    Color[] color;
    //TableItem tableItem;

    void ScrollCellIndex(int index)
    {
        //this.tableItem = GameControl.instance.listTable[index];
        if (index % 2 == 0)
        {
            backgroundSprite.color = color[0];
        }
        else
        {
            backgroundSprite.color = color[1];
        }
        lb_tenban.text = "Bàn " + index;//tableItem.id;
        lb_muccuoc.text = ""+index * 2;//BaseInfo.formatMoneyNormal(tableItem.money) + " " + Res.MONEY_FREE;
        lb_can.text = "" + index * 3;// BaseInfo.formatMoneyNormal(tableItem.needMoney) + " " + Res.MONEY_FREE;

        bool isLock = index % 3 1= 0;//tableItem.isLock == 1 ? true : false;
        spriteLock.gameObject.SetActive(isLock);
    }
}

qq 20160920120050

Please upload an example so I can dig it

@truongson-devgame
Copy link
Author

Thank for reply..
I solved it successfully. when I remove scrollbar, no errors, I add it to the error occurred...
how to fix...

@qiankanglai
Copy link
Owner

the reason is: I haven't implemented scrollbar in fact 😢
Other people have come up with it (#3). I made some effort before but this is far more complex than I think.

Do you need this seriously?

@truongson-devgame
Copy link
Author

Thank you for reply. I needed this. You can help me do it?

@qiankanglai
Copy link
Owner

I'll try implement this again with more constraints... would you provide more details about your requirements for me as reference?

@qiankanglai
Copy link
Owner

Sorry for very late reply...After a long struggle, I managed to implement scrollbar in 5104ca9

I've updated new README with demos.

@Ludomancer
Copy link

Ludomancer commented May 20, 2017

This issue seems to be appearing on Unity 5.6 again. Even for normal ScrollRect seems.

Trying to remove LogRow (UnityEngine.UI.Text) from rebuild list while we are already inside a rebuild loop. This is not supported. UnityEngine.GameObject:SetActive(Boolean) Pool:AddObjectToPool(PoolObject) (at Assets/Plugins/Internal/ScrollRectLoop/EasyObjectPool/EasyObjectPool.cs:72) Pool:ReturnObjectToPool(PoolObject) (at Assets/Plugins/Internal/ScrollRectLoop/EasyObjectPool/EasyObjectPool.cs:153) ResourceManager:ReturnObjectToPool(GameObject) (at Assets/Plugins/Internal/ScrollRectLoop/EasyObjectPool/ResourceManager.cs:109) UnityEngine.UI.LoopScrollRect:LateUpdate()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants