Acess by script to prefabs

I had problem with acess to prefab have a look.

I can acess model(obj file) Animator by

public Animator axeAnim;
 axeAnim = GameObject.Find("Hammer").GetComponent<Animator>();

Unfornatelly I can’t acess transform on these component.

public GameObject weapon;
 weapon = GameObject.Find("Hammer").GetComponent<GameObject>();

Console says there is no game object like hammer same situation is just for Transform…

I’m so annoye because is there a lot time spend on it with no result.
Please give me some advice, thanks

GameObject.Find() returns a GameObject. Also GameObjects are not Components, so you can’t use GetComponent to retrieve a GameObject.

GameObject weapon = GameObject.Find("Hammer");
// This will find the GameObject, assuming Hammer exists in the scene and is active.

if you want to get the Transform, it can be done in different ways:

Transform weapon = GameObject.Find("Hammer").transform;
Transform weapon = GameObject.Find("Hammer").GetComponent<Transform>();

As for Instantiating, the code looks ok. It’s important to put resources into a Resources folder, or else it won’t be found.

GameObject instance = Instantiate(Resources.Load("enemy", typeof(GameObject))) as GameObject;
// This works, assuming "enemy" exists in "Assets/Resources"