Search Unity

hold detection?

Discussion in 'Scripting' started by robertseadog, Sep 24, 2005.

  1. robertseadog

    robertseadog

    Joined:
    Jul 23, 2005
    Posts:
    374
    I want to delete this stupid post but it seems I can only delete my own sub-posts!

    A thought for future reference: I have to delete my script from the instance when I have made changes to it and reassign it in order for it to take effect.

    It has caused many unessecary posts like this, sorry otee!
     
  2. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    Er.... no. This should not be necessary. The script instance is automatically updated.
     
  3. robertseadog

    robertseadog

    Joined:
    Jul 23, 2005
    Posts:
    374
    Weird.. It didn't on my machine? well It doesn't matter, as long as I can delete my own posts that be nice ;)
     
  4. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    How do you mean by 'take effect'?

    Do you mean to forget all its defined properties and read the values from the script?

    The way I do this is that while I'm working on a script, I keep the variables private, so I the values are always the default ones supplied in the code. When the script has stabilized, I make the properties public...

    We did the something like it for GooBall. We had around 50 properties controlling all aspects of the ball behaviour. The properties we were happy with (and afraid to change), we copied the values to the script, then made variables private.
     
  5. socksy

    socksy

    Joined:
    May 21, 2005
    Posts:
    244
    Are you using TextWrangler? I only have to delete and save again with text wrangler. And did you set the default text editor for Unity to whatever editor?
     
  6. robertseadog

    robertseadog

    Joined:
    Jul 23, 2005
    Posts:
    374
    Yez this seems like the thing.. I solved it by detaching the script each time I changed the script :D

    Maybe not the best way of solving it though..
     
  7. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    Are you sure you are waiting long enough for the compilation to finish before hitting play?

    Detaching or attaching a script does not trigger a recompilation.
     
  8. robertseadog

    robertseadog

    Joined:
    Jul 23, 2005
    Posts:
    374
    No im not sure at all, all I know was that in the sleepy after hours that I usually work this seemed to do the trick but It might just have been a mind trick or some stupid little error that I just missed.

    But I did try just saving the script and not reassigning it and if I remember correctly it didn't reflect the changes I made..
     
  9. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    Was it a change to a default value of a variable? Because those are not reflected on the instance, as it will use the one stored in the object. (Even if you did not change it in the inspector.)