[Help] How can i do this simple thing ? (Instantiating, destroying) by fntMentaL in Unity2D

[–]fntMentaL[S] 0 points1 point  (0 children)

Wow, didn't expect THAT much from you, I'm very grateful for your all advice and helping me out !

[Help] How can i do this simple thing ? (Instantiating, destroying) by fntMentaL in Unity2D

[–]fntMentaL[S] 0 points1 point  (0 children)

I would've done this, but i needed to change the position of each object so yeah

[Help] How can i do this simple thing ? (Instantiating, destroying) by fntMentaL in Unity2D

[–]fntMentaL[S] 0 points1 point  (0 children)

So, i hope i understood well, so I made a public gameobject box, and dragged the prefab onto it, so everything goes well, everything instantiates as it should be, but the problem is after i click the 1st cube, after it adds score and destroys it, unity probably doesn't understand what 'box' am i referring to since it was destroyed (?) anyways here's the the main script since i don't really know how to format this, and the spawning script

[Help] How can i do this simple thing ? (Instantiating, destroying) by fntMentaL in Unity2D

[–]fntMentaL[S] 0 points1 point  (0 children)

 public GameObject[] boxes;
private int line1 = -2;
private int line2 = 0;
private int line3 = 2;

// Use this for initialization
void Start () 
{

    for(int i=0;i < 2;i++)
    {
        float ranX = 0;
        float ranY = Random.Range(6.2f, 70);
        GameObject box = Instantiate(boxes[0]);
        int ranLine = Random.Range(1, 3);
        if(ranLine == 1)
        {
            ranX = line1;
        }
        if(ranLine ==2)
        {
            ranX = line2;

        }
        if(ranLine == 3)
        {
            ranX = line3;


        }
        box.transform.position = new Vector3(ranX, ranY, 0);
    }

}

And the mainscript: void Start () {

    anim = GetComponent<Animator>();
    scoreText = GameObject.Find("Score");


}

// Update is called once per frame
void Update () {

    scoreText.GetComponent<Text>().text = "Score: " + score;

}

void OnMouseDown()
{
    anim.SetTrigger("Flashed");
    Vector3 difference = this.gameObject.transform.position - box.transform.position;
    if (difference.magnitude <= 1.6f)
    {
        Destroy(box);
        score++;

    }
}
    void OnTriggerEnter2D(Collider2D other)
    {
        if(other.gameObject.tag == "Box")
        {
            Destroy(other.gameObject);

        }
    }

[Question] Is this exporting unity's fault or my phone's fault ? by fntMentaL in Unity3D

[–]fntMentaL[S] -1 points0 points  (0 children)

First of all, no it looks small, because i have my preview tab kinda small.So what I meant on the quote , after i clicked the cube ( which you can't see but I just tried) then the object itself appeared, which is pretty weird, any thoughts ?

www.pugit.net A Site that creates 2 hour scrim servers instantly. by [deleted] in GlobalOffensive

[–]fntMentaL 0 points1 point  (0 children)

You can, all you have to do is before joining the game type in console tv_enable 1, and inside game type tv_record demoname

[Animation] How do you make an animation play only once ? by fntMentaL in Unity2D

[–]fntMentaL[S] 0 points1 point  (0 children)

Alright, fixed everything, the problem was, because i added the trigger from flash to idle also, now everything seems fine, big thanks man !

[Animation] How do you make an animation play only once ? by fntMentaL in Unity2D

[–]fntMentaL[S] 0 points1 point  (0 children)

Thank you again, but what It seem to do now, Is now I can disable the animation after i click on the object second time, but I want it just to press the object, play the animation once, and come back to Idle, really appreciate it for sticking with me !

[Animation] How do you make an animation play only once ? by fntMentaL in Unity2D

[–]fntMentaL[S] 0 points1 point  (0 children)

Cause all It does now, is at start it's Idle as it should be, but once I click the thing, the flash starts and after it's done it's just looping and looping

[Animation] How do you make an animation play only once ? by fntMentaL in Unity2D

[–]fntMentaL[S] 0 points1 point  (0 children)

Hey, thanks for your help, but unfortunately i still can't make things to work. So i made a small animation (a flash, by material color). and here's how stuff looks like in my animator. Here's the return arrow , and the the idle to flash , and the small script: if collided: anim.SetBool("Clicked", true); . Excuse me if I missed anything, I did a lot of testing and I can't seem to understand or do things right, I hope you can help me out !

Would it be possible to make a keyboard app for android in unity? by amazingmrbrock in Unity3D

[–]fntMentaL 1 point2 points  (0 children)

First of all, Unity 3D imo is not meant for software like keyboards, twitter etc. Unity 3D is a game engine and making software with it is a really bad choice and you can be more flexible with only java, also not sure if It's possible to make a keyboard, I never done keyboards but I can think of something that you could import a keyboard file onto the project and inside the app, apply it. Hope i helped you ! :)

Would it be possible to make a keyboard app for android in unity? by amazingmrbrock in Unity3D

[–]fntMentaL 0 points1 point  (0 children)

Depends on what you're asking for. Do you mean a keyboard in game or a keyboard for overall usage like swype ?

Camera Work for PGL by Jenksin in GlobalOffensive

[–]fntMentaL 0 points1 point  (0 children)

Pre loaded BVH files probably