# Problem with TD script (from java to c#)

**URL:** https://discussions.unity.com/t/problem-with-td-script-from-java-to-c/89192
**Category:** Questions & Answers
**Created:** [December 8, 2013, 4:48pm UTC](https://discussions.unity.com/t/problem-with-td-script-from-java-to-c/89192 "2013-12-08T16:48:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Sebulec](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Sebulec](https://discussions.unity.com/u/Sebulec)
#### Post date: [December 8, 2013, 4:48pm UTC](https://discussions.unity.com/t/problem-with-td-script-from-java-to-c/89192/1 "2013-12-08T16:48:44Z")

</div>

Hi guys. I’m making Tower Defence game and i stuck in scrip which i translated from java to c#. I have 3 errors and i can’t solve them

1. Assets/Skrypty/InGAmeGUI.cs(64,53): error CS0266: Cannot implicitly convert type `UnityEngine.Object' to `UnityEngine.GameObject’. An explicit conversion exists (are you missing a cast?)

2. Assets/Skrypty/InGAmeGUI.cs(66,64): error CS1612: Cannot modify a value type return value of `UnityEngine.Transform.localEulerAngles’. Consider storing the value in a temporary variable

3. Assets/Skrypty/InGAmeGUI.cs(95,25): error CS0103: The name `buildPanelTweener’ does not exist in the current context

---

<div class="post-metadata">

### Author: ![Fornoreason1000](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/fornoreason1000/32/401771_2.png) [@Fornoreason1000](https://discussions.unity.com/u/Fornoreason1000)
#### Post date: [December 8, 2013, 4:58pm UTC](https://discussions.unity.com/t/problem-with-td-script-from-java-to-c/89192/2 "2013-12-08T16:58:32Z")

</div>

Here you create a Object (not object) and assign it to a GameObject, you can use a cast like @tomekkie2 said, or use GameObject.Instantiate.  
Line64:

```
GameObject newStructure = GameObject.Instantiate( allStructures[structureIndex], lastHitObj.transform.position, Quaternion.identity );

```

This is more of a C# design error, you can’t assign one part of a vector, you need to change the whole thing(its weird I know). you can do this by creating a new vector with the same values except the ones you changed then assign it.  
Line66:

```
  newStructure.transform.localEulerAngles = new Vector3(
  newStructure.transform.localEulerAngles.x, 
  (Random.Range(0, 360)),
  newStructure.transform.localEulerAngles.z);

```

As for Line 95, you need to set the execution order for build panel tweener.  
based on that error, is probably still in Unityscript(“Javascript”). are you planning to convert that to C#?
