Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mygamingproject

Pages: [1] 2 3
1
Support / Re: Tilemap positioning
« on: April 28, 2015, 08:46:57 pm »
All the other objects and prefabs stay in place its only the tile map which moves.  Manual override with Wildcard and Fit Height scale seems fine across editor and device for everything bar the tilemap.

Any ideas?

2
Support / Re: Tilemap positioning
« on: April 28, 2015, 03:58:45 pm »
Thanks for the reply.

Not sure I'm following as it works fine in the editor. Wouldn't that be effectedthe same as on device?

3
Support / Tilemap positioning
« on: April 26, 2015, 08:11:42 pm »
I had a couple of tilemaps positioned and working fine in a released ios game but something odd has happened which I dont know is coincidence to a Unity 5 / Xcode 6.3 upgrade.

Its now the case that the Unity Editor shows everything fine but when viewed on device the tilemap will appear in the bottom right with only the top left 20% showing.  The rest of the screen shows a pink (non asset) area.

Any ideas as this has been baffled as I have not changed anything to my knowledge.

4
Support / Re: Centralising prefabs
« on: December 27, 2014, 01:13:08 pm »
Would you not have a parent gameobject and just move that like a container?

5
Support / Centralising prefabs
« on: December 27, 2014, 09:49:25 am »
I'm creating a 9x9 grid (think Match3 genre) and use a tile/square as a prefab which has all its characteristics. 

I generate columns and rows and then add prefabs to scene at runtime.

However, I want the alignment to be centralised to the screen for the purposes of resolution but not sure what the best way is to offset.  Do I add my tiles to a parent gameobject and centralise that GO to screen? Or do I work out the minus offset for x and y and start my tile building appropriately so 4.5 tile is the central position?

I kind of have the latter working but seems suboptimal.

6
Support / Re: tk2duiitem - gameobject sender
« on: October 25, 2014, 09:20:07 pm »
Rightly or wrongly I have gone about this a different way.

I had a buttonbehaviour object and script in scene but this couldn't be applied to the prefab.  So instead I changed tact and added the tk2duiitem via code..

Code: [Select]
private tk2dUIItem uiItem;

void OnEnable()
{
uiItem.OnClick += Clicked;
}

void OnDisable()
{
uiItem.OnClick -= Clicked;
}


void Awake()
{
uiItem = gameObject.AddComponent<tk2dUIItem>();
}

void Clicked()
{
Debug.Log ("Button clicked");


}

This seems to work and now means I have access to the data and object I needed in the first instance

7
Support / tk2duiitem - gameobject sender
« on: October 25, 2014, 11:40:19 am »
I have read through the forums and tutorials and struggling to get the sender gameobject on button click.

I have a prefab button that is instantiated.  There is a button controller which is the target of the tk2duiitem with the OnClick event being the following method

Code: [Select]
public void LoadGameClicked()
{
Debug.Log ("Load Game Clicked");
}

Which works fine

However if I want to access the parent GameObject so I can interrogate various parameters, classes etc on what to do next I'm not sure how to interpret the message.

For example,

Code: [Select]
public void LoadGameClicked(GameObject obj)
{
Debug.Log ("Load Game Clicked");
}

Errors with

MissingMethodException: The best match for method LoadGameClicked has some invalid parameter.

System.MonoType.InvokeMember (System.String name, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object target, System.Object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParameters) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/MonoType.cs:520)
UnityEngine.SetupCoroutine.InvokeMember (System.Object behaviour, System.String name, System.Object variable)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
tk2dUIItem:DoSendMessage(String) (at Assets/TK2DROOT/tk2dUI/Code/Core/tk2dUIItem.cs:246)
tk2dUIItem:Release() (at Assets/TK2DROOT/tk2dUI/Code/Core/tk2dUIItem.cs:266)
tk2dUIManager:CheckInputs() (at Assets/TK2DROOT/tk2dUI/Code/Core/tk2dUIManager.cs:443)
tk2dUIManager:Update() (at Assets/TK2DROOT/tk2dUI/Code/Core/tk2dUIManager.cs:321)

How do I get hold of the gameobject, any assistance would be greatly appreciated?

8
Support / Re: Switching TileMaps
« on: September 03, 2014, 09:07:38 pm »
Thanks for the tip but how do you reference the renderer and dataobject as have tried tagging

http://imgur.com/YFWSjzB

and then referencing like this:

Code: [Select]

GameObject tileObj = GameObject.FindGameObjectWithTag("StandardTileMap");
tk2dTileMap tilemap = tileObj.GetComponent<tk2dTileMap>();
tilemap.renderData.renderer.enabled = false;

But get the error:

Quote
MissingComponentException: There is no 'Renderer' attached to the "TileMap Render Data" game object, but a script is trying to access it.
You probably need to add a Renderer to the game object "TileMap Render Data". Or your script needs to check if the component is attached before using it.
GameLoop.Awake () (at Assets/Scripts/GameLoop.cs:36)


Have I misunderstood what you mean?

9
Support / Switching TileMaps
« on: September 02, 2014, 08:57:18 pm »
I have a gamescene which has a tilemap,  all working nicely for 3 levels.

However, I have added a new level within the same gamescene but the tilemap is slightly different. I don't want to duplicate the gamescene for the sake of about 30% of the tiles so is there a way of hiding a tilemap and showing another?  There is no renderer attached to a tilemap so that isnt a default option which made my think because of this it wasnt the right route to take.

What would you suggest?

10
Support / Re: Colliders on screen / camera edge
« on: August 27, 2014, 11:00:06 am »
I thought of those but assumed that might only work within the camera bounds not outside of it

11
Support / Colliders on screen / camera edge
« on: August 27, 2014, 10:20:56 am »
I want to have it so that the screen edge is the limit of movement.  Coding this is straightforward but physics is involved so dont really want to be doing messy inverse forces to imply boundary checks.

What I was thinking was applying a "soft" material box collider to the left and right sides of the camera view but then thought about the issue of different screen resolutions widths i.e. iphone5 over iphone4 for example. 

Is it possible to anchor a box collider on either side but out of view to achieve this effect.  If so how is best to accomplish it?

12
Support / Re: Programmatically positioning within camera view
« on: August 24, 2014, 10:39:49 pm »
Yep that did it thanks

My camera origin was actually marked as center so I came up with the crude code as follows which works

Code: [Select]
Vector3 cameraPosition = camera.transform.position;

Rect extents = camera.ScreenExtents;
float screenX = Random.Range(cameraPosition.x -  (extents.width * 0.5f), cameraPosition.x + (extents.width * 0.5f));

blockPrefab.Spawn(new Vector3(screenX, 26.0f, 0.0f), transform.rotation);

13
Support / Re: Programmatically positioning within camera view
« on: August 24, 2014, 03:51:48 pm »
Its a tk2dCamera

With the following settings:

http://imgur.com/L5QpgpO
http://imgur.com/KJxMxLh
http://imgur.com/5SlH4lU

Setup to handle iDevice resolutions

14
Support / Programmatically positioning within camera view
« on: August 24, 2014, 11:31:01 am »
I think I am probably making this difficult for myself but I simply want to spawn a prefab in a position that is always within the camera view.

The issue I think I am having is I'm confusing pixels with Screen points in my positioning so some appear and some others don't but nonetheless can't work it out.

Any assistance would be appreciated.

15
Support / Re: Need help with using Sprite ID's for hit detection
« on: August 16, 2014, 10:15:32 am »
Can you not create a prefab and name the objects via tags?

This is what I have done and works well when the object is available to the scene.  By coincidence I have just posted on the forum that I am unable to read the tag if its been instantiated and as such the layer collision matrix doesnt work and therefore unintentionally collides.

Pages: [1] 2 3