Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Room of Shadows

Discussion in 'Editor & General Support' started by whitedrow, Apr 5, 2008.

  1. whitedrow

    whitedrow

    Joined:
    Mar 31, 2008
    Posts:
    15
    Hi,

    is there any way to have a detailed look in the "Room of Shadow" demo (http://unity3d.com/gallery/live-demos/shadows)?

    Or is the raw file already in the unity trial package and I'm unable to find it?

    I'm very interested in the programming of the demo 'cause nearly 90% of the things I'm looking for to learn are already realised in this demo.

    Best regards,
    whitedrow
     
  2. Jens

    Jens

    Joined:
    Aug 14, 2007
    Posts:
    18
    Hi!

    That's easy!
    You don't need the project file as this is really easy to do yourself.

    1. You need UnityPro or ProTrial, as Real-time shadows are a pro-only
    feature.

    2. Place your scene by dragging it from your project view into the scene view.

    3.Then place some lights and rigidbodies into your scene.

    3. Add an empty Game-Object and add the "Drag Rigidbody"-script to it.

    4. Press Play.

    5. You can drag the rigidbodies with your mouse in the Gameview.


    Greets Jens
     
  3. whitedrow

    whitedrow

    Joined:
    Mar 31, 2008
    Posts:
    15
    ok, i've tried it and it works of course.
    But what I'm also interested in is:
    How do the buttons switch on/off some light?

    I've created a cube with a script:
    Code (csharp):
    1.  
    2. var test:int=1;
    3.  
    And I created a button (named "myCube"). If clicked it should read the var "test" from "myCube" and increment the value.


    Code (csharp):
    1.  
    2. function OnGUI(){
    3.    if(GUI.Button(Rect(10,10,150,100), "Click me")){
    4.       obj = GameObject.Find("myCube");
    5.       if(obj == null){
    6.           print("Object not found");
    7.       }
    8.       else{
    9.           print(obj.test);
    10.           obj.test ++;
    11.       }
    12.    }
    13. }
    14.  
    But this doesn't work. Can you give me a hint?
    Or are there other ways to let objects communicate with eachother?
     
  4. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Instead of:
    Code (csharp):
    1. obj.test ++;
    Try this:
    Code (csharp):
    1. obj.GetComponent (ScriptName).test += 1;
     
  5. whitedrow

    whitedrow

    Joined:
    Mar 31, 2008
    Posts:
    15
    Great, thank you.

    just for info:

    obj.GetComponent (ScriptName).test += 1;
    obj.GetComponent ("ScriptName").test += 1;
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Well according the page, rt soft shadows are Pro only. Why are hard shadows inaccessable then?
    Incorrect feature notification on the download page?!
     
  7. Jens

    Jens

    Joined:
    Aug 14, 2007
    Posts:
    18
    real time shadows require render-textures,
    render-textures a a pro-only feature.
    So all real time shadows are disabled in indie.

    Jens
     
  8. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    If they are all render target based then yes it makes sense, thank you for the clarification.
    Hopefully the page will get this clarification somewhen as well