Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

Some questions...

Discussion in 'Scripting' started by taumel, May 20, 2006.

  1. taumel

    taumel

    Joined:
    Jun 9, 2005
    Posts:
    5,293
    Hi,

    i do have a couple of smaller questions:

    a) What Format-Parameters can "toString()" handle? Is this documented anywhere?
    b) How do i perform an action on an object which i destroy by using the"destroy(obj,secs)" method when the object get's destroyed. Is there anything like "function on_destroy_me {} then"?
    c) Is there any way i can access a public global variable from and to all scripts without naming a certain script?
    d) How to bring an object into a specified rotation. I don't want to rotate it about a ceratin degree i want it to be in the rotation i give the vector(x,y,z) for. And can i choose if this rotation is meant in local space, world space or a specified parent space?


    Thanks,

    taumel
     
  2. SparrowsNest

    SparrowsNest

    Joined:
    Apr 6, 2017
    Posts:
    1,721
    How did you get here? o:

    this thread is from 2006..
     
  3. Miggi124

    Miggi124

    Joined:
    Jul 31, 2017
    Posts:
    69
    ...somebody chose the last page...
     
    SparrowsNest likes this.
  4. TaleOf4Gamers

    TaleOf4Gamers

    Joined:
    Nov 15, 2013
    Posts:
    789
    Well, I guess now that this has been resurrected, may aswell answer the post and add something of value if it is found again in the future.

    A) ToString has so many uses I cant list them all (I remember a list on the MSDN website a while ago but I cannot find it). Anyone can override ToString but some of its default uses for things like numbers are:

    • ToString("N2") - Print number to 2 decimal places.
    • ToString("C", SomeCulture) - Print number as currency
    EDIT:

    Found it: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings

    B) OnDestroy perhaps

    C) Not sure exactly what is meant here. I assume a static but without having to reference a class too. I do not think this is possible. Only enums do not have to belong to a class.

    D) Quaternion.Euler perhaps

    Feel free to close this thread now :)
     
    Ryiah and Miggi124 like this.
  5. Miggi124

    Miggi124

    Joined:
    Jul 31, 2017
    Posts:
    69
    Well I guess that kinda wraps things up lol - have a nice night everyone. :)
     
    TaleOf4Gamers likes this.