Search Unity

objects in assets HELP?

Discussion in 'Scripting' started by JJB653, Apr 23, 2014.

  1. JJB653

    JJB653

    Joined:
    Apr 18, 2014
    Posts:
    24
    hey ive got an enemy in my assets that my spawner uses to spawn on the scene, the enemy has a script attached that needs the spawnscript to decrement the enemy count. so i put:

    Code (csharp):
    1. var countScript:enemyscript;
    so in the inspector i can place the script, but when i try it with the cube in the assets it wont allow me but if the cube is in the scene i can do it, is there anyway to assign the script to the cube while its in the assets?
     
  2. laurelhach

    laurelhach

    Joined:
    Dec 1, 2013
    Posts:
    229
    You probably need to create a Prefab with your cube.
    You can't add scripts to your assets in your resources folder unless it is a Prefab (unless there are special cases I am not aware of).
    To do that, just drag your cube from your scene into one of your folder in your project view (your object in your scene should become blue).