#Particle Instantiate Not Appearing

1 messages · Page 1 of 1 (latest)

hollow latch
#

Yeah I can preview it and it seems to work normally. The documentation is a little poor but there is a sample scene included with the asset that works like a charm. This is the code that is used in the sample scene

void MakeObject()
    {
        DestroyGameObject();
        gm = Instantiate(m_effects[index],
            m_effects[index].transform.position,
            m_effects[index].transform.rotation).gameObject;
        m_effectName.text = (index+1) +" : "+m_effects[index].name.ToString();
        scaleform.transform.position = gm.transform.position;
        gm.transform.parent = scaleform.transform;
        gm.transform.localScale = new Vector3(1,1,1);
        float submit_scalefactor = m_gaph_scenesizefactor;
        if (index < 70)
            submit_scalefactor *= 0.5f;
        gm.transform.localScale = new Vector3(submit_scalefactor, submit_scalefactor, submit_scalefactor);
        m_destroyObjects[inputLocation] = gm;
        inputLocation++;
    }
gusty night
#

So, do you need to load it dynamically from resources? Why not just drag the prefab into your scene?

hollow latch
#

The use case is I have a bunch of cards that will play effects on abilities or on attack. I expect I will have a lot of them. Might be worth testing with 1 just to see but I don't think the problem is on the load part. I have a similar process for creating the cards that works well.

gusty night
#

Where do you call CreateEffect? Might shed some light on wether it sticks around long enough to be visible

hollow latch
#

It's run from a coroutine right now (the whole card attack process is a little in flux)
Doesn't Instantiating a gameObject add it to the scene and then it observes normal lifecycle?

IEnumerator doCardActions(Card[] turnPlayerCards, Card[] defensivePlayerCards){
        Debug.Log("Do Card Actions");
        for (int i = 0; i < turnPlayerCards.Length; i++){
            Debug.Log("in for loop");
            Card currentCard = turnPlayerCards[i];
            currentCard.CreateAttackEffect();
            //do skills for cards [i]
            //attack opponent card
            if(defensivePlayerCards != null && defensivePlayerCards.Length >= i){
                defensivePlayerCards[i].handleCardEvent(new CardEvent(currentCard, CardEvent.Type.DAMAGE, currentCard.Attack, CardEvent.Target.ENEMY_OPPOSITE));
            } else {
                //TODO:attack opposing player
            } 
            yield return new WaitForSeconds(.5f);
        }
    }

And then the battle loop

IEnumerator BattleLoop(){
        Debug.Log("BattleLoop");
        if(battleStart){
            if(playerTurn){
                drawPlayerCard();
                StartCoroutine(doCardActions(playerBattlefield.GetComponentsInChildren<Card>(), opponentBattlefield.GetComponentsInChildren<Card>()));
                playerTurn = !playerTurn; //pass the turn
            } else {
                drawOpponentCard();
                StartCoroutine(doCardActions(opponentBattlefield.GetComponentsInChildren<Card>(), playerBattlefield.GetComponentsInChildren<Card>()));
                playerTurn = !playerTurn; //pass the turn
            }
        } else {
            battleStart = true;
        }
        hasPlayedCard = false;
        if(!playerTurn){
            yield return new WaitForSeconds(2.5f); //amount of time AI waits to play a card
        }
        yield return new WaitUntil(hasTakenTurn);
        StartCoroutine("BattleLoop");
    }
#

create attack effect on the card just calls

public void CreateAttackEffect(){
        EffectManager.CreateEffect(gameObject);
    }
gusty night
hollow latch
#

No scripts on the prefab. It's just a couple of top level holders and a bunch of particle children.
Logs look exactly like I would expect if it would work
I wonder if maybe something is wrong with the scale or if its spawning under the card. Also possible something is wrong with my renderer or something (or even a webgl specific issue)

gusty night
hollow latch
gusty night
hollow latch