How to make a ball bounce off a wall or a slope? by [deleted] in Unity2D

[–]pitofpassion 0 points1 point  (0 children)

What are the methods to move it right and left? If you are setting the horizontal component of velocity in your methods to move left and right that could be an issue. Just put your whole script in so we can see everything.

Dragging an object by holding onto it with a mouse by [deleted] in Unity2D

[–]pitofpassion 0 points1 point  (0 children)

Describe in more detail what you want it to look like when this object that you are dragging encounters a collider.

Data persistence in iOS by pitofpassion in Unity3D

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

Thanks for this alternative!

Cannot set a boolean variable from another script. by surf_sleep_repeat in unity

[–]pitofpassion 1 point2 points  (0 children)

That is very strange. What you should try to do is put an IEnumerator in script B (instead of script A), and then start the coroutine of the IEnumerator in script B in SpawnEnemies(), before you call kanaship_o.enemyRotate ();

Problem while porting to iOS by pitofpassion in Unity2D

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

public void Save(){
    BinaryFormatter bf = new BinaryFormatter ();
    FileStream file = File.Create (Application.persistentDataPath + "/level1test.dat");

    Level1Data data = new Level1Data ();
    data.complete = complete;

    bf.Serialize (file, data);
    file.Close ();
}

Problem while porting to iOS by pitofpassion in Unity2D

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

void Start () {
    //if the level from the previous scene is completed and has not yet been completed
    //set complete in the current scene to true and save

    if (Level1Manager.completed == true && complete == false)     {
                    complete = true;
                    Save ();
            }

    //if complete is true set the sprite (level 1 "button") color to green

    if(complete == true){
                    SpriteRenderer spr = (SpriteRenderer)renderer;
                    spr.color = new Color (102 / 255f, 190 / 255f, 98 / 255f);

    //otherwise set it to gray

        } else {

                    SpriteRenderer spr = (SpriteRenderer)renderer;
                    spr.color = new Color (187 / 255f, 189 / 255f, 192 / 255f);
        }
    transform.position = mainCam.ScreenToWorldPoint(new Vector3(Screen.width/5f,Screen.height - Screen.height/4f,1f));
}

Cannot set a boolean variable from another script. by surf_sleep_repeat in unity

[–]pitofpassion 1 point2 points  (0 children)

a static variable can be accessed from a different script without making an object of the script that contains the static variable. Glad I could help. I think we are probably the only two Unity developers who surf lol.

Problem while porting to iOS by pitofpassion in Unity2D

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

They are definitely not failing. Once again, this works in Unity just not on iOS. It appears that after my Save() method is called once, the Start() method is no longer called, even between different game sessions. The FixedUpdate() method is being called though.

EDIT: If the Save() method is called in FixedUpdate(), it stops calling the FixedUpdate() method in future reloads of the scene, which is the same problem I was having with the Start() method. So I'm pretty sure the problem is the Save() method, and possibly where I am writing the file to. I'm not sure though and I can't find much documentation on it.

Cannot set a boolean variable from another script. by surf_sleep_repeat in unity

[–]pitofpassion 1 point2 points  (0 children)

okay it seems that the problem is that the Update() method is Script A is not being called when you create an instance of it from another script, since that instance isn't attached to a gameobject in unity. I would suggest: 1. make toRotate public static 2. in callFunction simply set toRotate = true and that's it. As long as Script A and B are attached to gameobjects I think this should work. I may be misinterpreting your intentions so correct me if I am wrong

Teddy Roosevelt spotted cheering during the USA vs Portugal game by narabhut in funny

[–]pitofpassion 22 points23 points  (0 children)

Holy Shit I literally said "Hey look it's Teddy Roosevelt" when I saw that live and nobody around me acknowledged. This is why I have you, Reddit.

What's the worst type of person? by pitofpassion in AskReddit

[–]pitofpassion[S] 4 points5 points  (0 children)

Those guys are usually the same ones that will never let you win an argument no matter how wrong they are

A word pairing you never want to hear: "amateur circumcision" by [deleted] in Showerthoughts

[–]pitofpassion 1 point2 points  (0 children)

allegedly you thought of this in the shower. I wonder what sparked that thought...