Create a ScriptedTexture

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to navigation Jump to search

ScriptedTextures have been implemented in all generations of the Unreal Engine, but their usage differs between the various generations.

Unreal Engine 1

A ScriptedTexture(no matching games found) can only be created statically via UnrealEd's Texture Browser.

UnrealEd 2

The "New Texture" dialog in UnrealEd 2.
  1. Open the Texture Browser.
  2. Select File -> New... from the browser's menu.
  3. Specify a target package and texture name, optionally also a group name.
  4. Set the texture class to ScriptedTexture.
  5. Pick texture dimensions that fit your needs.
  6. Click OK.

As always, you need to save the package, unless you put the texture in the myLevel pseudo-package.

UnrealEd 1

The "Create a new texture" dialog in UnrealEd 1.
  1. Switch to the Texture Browser.
  2. Click New at the bottom of the browser panel.
  3. Specify a target package and texture name, optionally also a group name.
  4. Set the texture class to ScriptedTexture.
  5. Pick the desired texture dimensions.
  6. Click Create this texture.

Again, you need to save the package if you don't use myLevel.

Unreal Engine 2

The "New Material" dialog in UnrealEd 3.

You can create the ScriptedTexture(no matching games found) either statically with UnrealEd 3 or dynamically in UnrealScript.

In UnrealEd

Use this method if you need a texture e.g. for a CameraTextureClient(no matching games found).

  1. Open the Texture Browser.
  2. Select File -> New... from the browser's menu.
  3. Specify a target package and texture name, optionally also a group name.
  4. Use the factory class "Raw Material".
  5. Set the MaterialClass in the factory properties to ScriptedTexture (class'Engine.ScriptedTexture').
  6. Click New.
  7. The ScriptedTexture properties window should open automatically. Set the desired dimensions via UClamp and VClamp there.

As usual, unless you put it in myLevel, you need to save the package.

In UnrealScript

A ScriptedTexture can be created with the following code snippet: <uscript> local ScriptedTexture ST;

ST = new class'ScriptedTexture'; ST.SetSize(SizeX, SizeY); ST.Client = someActor; </uscript> This creates a new ScriptedTexture that is SizeX pixels wide and SizeY high that is rendered through the RenderTexture() event of someActor.

Note that this example may waste resources if the ScriptedTexture will only be used for a limited duration. The UT2004 Hellbender (Onslaught.ONSPRV) provides a more efficient example for this case, using the global ObjectPool(no matching games found) to allocate and release the ScriptedTexture used for the license plate.

Unreal Engine 3

A ScriptedTexture(no matching games found) is created with the following syntax: <uscript> local ScriptedTexture ST;

ST = ScriptedTexture(class'ScriptedTexture'.static.Create(SizeX, SizeY,, ClearColor)); ST.Render = RenderFunction; </uscript> This creates a new ScriptedTexture that is SizeX pixels wide and SizeY high that is cleared to ClearColor before redrawing. RenderFunction must be a function without return value that has only one parameter of type Canvas(no matching games found).

Usually you will want the ScriptedTexture to be specified as Material parameter.